@@ -58,8 +58,9 @@ discard block |
||
58 | 58 | $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
59 | 59 | } |
60 | 60 | |
61 | - if ( ($url = $style->background_image) && $url !== "none" ) |
|
62 | - $this->_background_image($url, $x, $y, $w, $h, $style); |
|
61 | + if ( ($url = $style->background_image) && $url !== "none" ) { |
|
62 | + $this->_background_image($url, $x, $y, $w, $h, $style); |
|
63 | + } |
|
63 | 64 | |
64 | 65 | |
65 | 66 | $this->_render_border($frame); |
@@ -81,8 +82,9 @@ discard block |
||
81 | 82 | foreach ($bp as $side => $props) { |
82 | 83 | list($x, $y, $w, $h) = $bbox; |
83 | 84 | |
84 | - if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) |
|
85 | - continue; |
|
85 | + if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) { |
|
86 | + continue; |
|
87 | + } |
|
86 | 88 | |
87 | 89 | |
88 | 90 | switch($side) { |
@@ -62,8 +62,9 @@ |
||
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - if ( $frame->get_parent() !== $this ) |
|
66 | - throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
65 | + if ( $frame->get_parent() !== $this ) { |
|
66 | + throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
67 | + } |
|
67 | 68 | |
68 | 69 | $split = $this->copy( $this->_frame->get_node()->cloneNode() ); |
69 | 70 | $this->get_parent()->insert_child_after($split, $this); |
@@ -100,10 +100,11 @@ discard block |
||
100 | 100 | break; |
101 | 101 | |
102 | 102 | case "inline": |
103 | - if ( $frame->get_node()->nodeName === "#text" ) |
|
104 | - $this->_render_frame("text", $frame); |
|
105 | - else |
|
106 | - $this->_render_frame("inline", $frame); |
|
103 | + if ( $frame->get_node()->nodeName === "#text" ) { |
|
104 | + $this->_render_frame("text", $frame); |
|
105 | + } else { |
|
106 | + $this->_render_frame("inline", $frame); |
|
107 | + } |
|
107 | 108 | break; |
108 | 109 | |
109 | 110 | case "table-cell": |
@@ -126,9 +127,7 @@ discard block |
||
126 | 127 | $node->getAttribute("language") === "php" ) { |
127 | 128 | // Evaluate embedded php scripts |
128 | 129 | $this->_render_frame("php", $frame); |
129 | - } |
|
130 | - |
|
131 | - elseif ( $node->getAttribute("type") === "text/javascript" || |
|
130 | + } elseif ( $node->getAttribute("type") === "text/javascript" || |
|
132 | 131 | $node->getAttribute("language") === "javascript" ) { |
133 | 132 | // Insert JavaScript |
134 | 133 | $this->_render_frame("javascript", $frame); |
@@ -146,8 +145,9 @@ discard block |
||
146 | 145 | // Check for begin frame callback |
147 | 146 | $this->_check_callbacks("begin_frame", $frame); |
148 | 147 | |
149 | - foreach ($frame->get_children() as $child) |
|
150 | - $this->render($child); |
|
148 | + foreach ($frame->get_children() as $child) { |
|
149 | + $this->render($child); |
|
150 | + } |
|
151 | 151 | |
152 | 152 | // Check for end frame callback |
153 | 153 | $this->_check_callbacks("end_frame", $frame); |
@@ -52,8 +52,10 @@ discard block |
||
52 | 52 | function render(Frame $frame) { |
53 | 53 | $style = $frame->get_style(); |
54 | 54 | |
55 | - if ( !$frame->get_first_child() ) |
|
56 | - return; // No children, no service |
|
55 | + if ( !$frame->get_first_child() ) { |
|
56 | + return; |
|
57 | + } |
|
58 | + // No children, no service |
|
57 | 59 | |
58 | 60 | // Draw the left border if applicable |
59 | 61 | $bp = $style->get_border_properties(); |
@@ -87,8 +89,9 @@ discard block |
||
87 | 89 | // borders on this line. |
88 | 90 | |
89 | 91 | // Background: |
90 | - if ( ($bg = $style->background_color) !== "transparent" ) |
|
91 | - $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color); |
|
92 | + if ( ($bg = $style->background_color) !== "transparent" ) { |
|
93 | + $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color); |
|
94 | + } |
|
92 | 95 | |
93 | 96 | if ( ($url = $style->background_image) && $url !== "none" ) { |
94 | 97 | $this->_background_image($url, $x, $y, $w, $h, $style); |
@@ -118,8 +121,9 @@ discard block |
||
118 | 121 | // Handle anchors & links |
119 | 122 | if ( $frame->get_node()->nodeName === "a" ) { |
120 | 123 | |
121 | - if ( $href = $frame->get_node()->getAttribute("href") ) |
|
122 | - $this->_canvas->add_link($href, $x, $y, $w, $h); |
|
124 | + if ( $href = $frame->get_node()->getAttribute("href") ) { |
|
125 | + $this->_canvas->add_link($href, $x, $y, $w, $h); |
|
126 | + } |
|
123 | 127 | |
124 | 128 | } |
125 | 129 | |
@@ -130,18 +134,20 @@ discard block |
||
130 | 134 | continue; |
131 | 135 | } |
132 | 136 | |
133 | - if ( is_null($w) ) |
|
134 | - $w = $child_w; |
|
135 | - else |
|
136 | - $w += $child_w; |
|
137 | + if ( is_null($w) ) { |
|
138 | + $w = $child_w; |
|
139 | + } else { |
|
140 | + $w += $child_w; |
|
141 | + } |
|
137 | 142 | |
138 | 143 | $h = max($h, $child_h); |
139 | 144 | } |
140 | 145 | |
141 | 146 | |
142 | 147 | // Handle the last child |
143 | - if ( ($bg = $style->background_color) !== "transparent" ) |
|
144 | - $this->_canvas->filled_rectangle( $x + $widths[3], $y + $widths[0], $w, $h, $style->background_color); |
|
148 | + if ( ($bg = $style->background_color) !== "transparent" ) { |
|
149 | + $this->_canvas->filled_rectangle( $x + $widths[3], $y + $widths[0], $w, $h, $style->background_color); |
|
150 | + } |
|
145 | 151 | |
146 | 152 | //On continuation lines (after line break) of inline elements, the style got copied. |
147 | 153 | //But a non repeatable background image should not be repeated on the next line. |
@@ -151,8 +157,9 @@ discard block |
||
151 | 157 | // Repeat not given: default is Style::__construct |
152 | 158 | // ... && (!($repeat = $style->background_repeat) || $repeat === "repeat" ... |
153 | 159 | //different position? $this->_background_image($url, $x, $y, $w, $h, $style); |
154 | - if ( ($url = $style->background_image) && $url !== "none" ) |
|
155 | - $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style); |
|
160 | + if ( ($url = $style->background_image) && $url !== "none" ) { |
|
161 | + $this->_background_image($url, $x + $widths[3], $y + $widths[0], $w, $h, $style); |
|
162 | + } |
|
156 | 163 | |
157 | 164 | // Add the border widths |
158 | 165 | $w += $widths[1] + $widths[3]; |
@@ -190,11 +197,13 @@ discard block |
||
190 | 197 | // Handle anchors & links |
191 | 198 | if ( $frame->get_node()->nodeName === "a" ) { |
192 | 199 | |
193 | - if ( $name = $frame->get_node()->getAttribute("name") ) |
|
194 | - $this->_canvas->add_named_dest($name); |
|
200 | + if ( $name = $frame->get_node()->getAttribute("name") ) { |
|
201 | + $this->_canvas->add_named_dest($name); |
|
202 | + } |
|
195 | 203 | |
196 | - if ( $href = $frame->get_node()->getAttribute("href") ) |
|
197 | - $this->_canvas->add_link($href, $x, $y, $w, $h); |
|
204 | + if ( $href = $frame->get_node()->getAttribute("href") ) { |
|
205 | + $this->_canvas->add_link($href, $x, $y, $w, $h); |
|
206 | + } |
|
198 | 207 | } |
199 | 208 | } |
200 | 209 | } |
@@ -146,8 +146,9 @@ |
||
146 | 146 | // Small hack to prevent indenting of list text |
147 | 147 | // Image Might not exist, then position like on list_bullet_frame_decorator fallback to none. |
148 | 148 | if ( $this->_frame->get_style()->list_style_position === "outside" || |
149 | - $this->_width == 0) |
|
150 | - return 0; |
|
149 | + $this->_width == 0) { |
|
150 | + return 0; |
|
151 | + } |
|
151 | 152 | //This aligns the "inside" image position with the text. |
152 | 153 | //The text starts to the right of the image. |
153 | 154 | //Between the image and the text there is an added margin of image width. |
@@ -61,8 +61,9 @@ discard block |
||
61 | 61 | |
62 | 62 | // FIXME: this is admittedly a little smelly... |
63 | 63 | static function decorate_frame(Frame $frame, $dompdf) { |
64 | - if ( is_null($dompdf) ) |
|
65 | - throw new Exception("foo"); |
|
64 | + if ( is_null($dompdf) ) { |
|
65 | + throw new Exception("foo"); |
|
66 | + } |
|
66 | 67 | switch ($frame->get_style()->display) { |
67 | 68 | |
68 | 69 | case "block": |
@@ -127,15 +128,17 @@ discard block |
||
127 | 128 | break; |
128 | 129 | |
129 | 130 | case "-dompdf-list-bullet": |
130 | - if ( $frame->get_style()->list_style_position === "inside" ) |
|
131 | - $positioner = "Inline"; |
|
132 | - else |
|
133 | - $positioner = "List_Bullet"; |
|
134 | - |
|
135 | - if ( $frame->get_style()->list_style_image !== "none" ) |
|
136 | - $decorator = "List_Bullet_Image"; |
|
137 | - else |
|
138 | - $decorator = "List_Bullet"; |
|
131 | + if ( $frame->get_style()->list_style_position === "inside" ) { |
|
132 | + $positioner = "Inline"; |
|
133 | + } else { |
|
134 | + $positioner = "List_Bullet"; |
|
135 | + } |
|
136 | + |
|
137 | + if ( $frame->get_style()->list_style_image !== "none" ) { |
|
138 | + $decorator = "List_Bullet_Image"; |
|
139 | + } else { |
|
140 | + $decorator = "List_Bullet"; |
|
141 | + } |
|
139 | 142 | |
140 | 143 | $reflower = "List_Bullet"; |
141 | 144 | break; |
@@ -163,8 +166,9 @@ discard block |
||
163 | 166 | } |
164 | 167 | |
165 | 168 | if ( $frame->get_style()->position === "absolute" || |
166 | - $frame->get_style()->position === "fixed" ) |
|
167 | - $positioner = "Absolute"; |
|
169 | + $frame->get_style()->position === "fixed" ) { |
|
170 | + $positioner = "Absolute"; |
|
171 | + } |
|
168 | 172 | |
169 | 173 | $positioner .= "_Positioner"; |
170 | 174 | $decorator .= "_Frame_Decorator"; |
@@ -102,8 +102,9 @@ discard block |
||
102 | 102 | function dispose($recursive = false) { |
103 | 103 | |
104 | 104 | if ( $recursive ) { |
105 | - while ( $child = $this->get_first_child() ) |
|
106 | - $child->dispose(true); |
|
105 | + while ( $child = $this->get_first_child() ) { |
|
106 | + $child->dispose(true); |
|
107 | + } |
|
107 | 108 | } |
108 | 109 | |
109 | 110 | unset($this->_root); |
@@ -134,8 +135,9 @@ discard block |
||
134 | 135 | $deco = Frame_Factory::decorate_frame($frame, $this->_dompdf); |
135 | 136 | $deco->set_root($this->_root); |
136 | 137 | |
137 | - foreach ($this->get_children() as $child) |
|
138 | - $deco->append_child($child->deep_copy()); |
|
138 | + foreach ($this->get_children() as $child) { |
|
139 | + $deco->append_child($child->deep_copy()); |
|
140 | + } |
|
139 | 141 | |
140 | 142 | return $deco; |
141 | 143 | } |
@@ -146,8 +148,9 @@ discard block |
||
146 | 148 | $this->_frame->reset(); |
147 | 149 | |
148 | 150 | // Reset all children |
149 | - foreach ($this->get_children() as $child) |
|
150 | - $child->reset(); |
|
151 | + foreach ($this->get_children() as $child) { |
|
152 | + $child->reset(); |
|
153 | + } |
|
151 | 154 | |
152 | 155 | } |
153 | 156 | |
@@ -183,42 +186,49 @@ discard block |
||
183 | 186 | function __toString() { return $this->_frame->__toString(); } |
184 | 187 | |
185 | 188 | function prepend_child(Frame $child, $update_node = true) { |
186 | - while ( $child instanceof Frame_Decorator ) |
|
187 | - $child = $child->_frame; |
|
189 | + while ( $child instanceof Frame_Decorator ) { |
|
190 | + $child = $child->_frame; |
|
191 | + } |
|
188 | 192 | |
189 | 193 | $this->_frame->prepend_child($child, $update_node); |
190 | 194 | } |
191 | 195 | |
192 | 196 | function append_child(Frame $child, $update_node = true) { |
193 | - while ( $child instanceof Frame_Decorator ) |
|
194 | - $child = $child->_frame; |
|
197 | + while ( $child instanceof Frame_Decorator ) { |
|
198 | + $child = $child->_frame; |
|
199 | + } |
|
195 | 200 | |
196 | 201 | $this->_frame->append_child($child, $update_node); |
197 | 202 | } |
198 | 203 | |
199 | 204 | function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) { |
200 | - while ( $new_child instanceof Frame_Decorator ) |
|
201 | - $new_child = $new_child->_frame; |
|
205 | + while ( $new_child instanceof Frame_Decorator ) { |
|
206 | + $new_child = $new_child->_frame; |
|
207 | + } |
|
202 | 208 | |
203 | - if ( $ref instanceof Frame_Decorator ) |
|
204 | - $ref = $ref->_frame; |
|
209 | + if ( $ref instanceof Frame_Decorator ) { |
|
210 | + $ref = $ref->_frame; |
|
211 | + } |
|
205 | 212 | |
206 | 213 | $this->_frame->insert_child_before($new_child, $ref, $update_node); |
207 | 214 | } |
208 | 215 | |
209 | 216 | function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) { |
210 | - while ( $new_child instanceof Frame_Decorator ) |
|
211 | - $new_child = $new_child->_frame; |
|
217 | + while ( $new_child instanceof Frame_Decorator ) { |
|
218 | + $new_child = $new_child->_frame; |
|
219 | + } |
|
212 | 220 | |
213 | - while ( $ref instanceof Frame_Decorator ) |
|
214 | - $ref = $ref->_frame; |
|
221 | + while ( $ref instanceof Frame_Decorator ) { |
|
222 | + $ref = $ref->_frame; |
|
223 | + } |
|
215 | 224 | |
216 | 225 | $this->_frame->insert_child_after($new_child, $ref, $update_node); |
217 | 226 | } |
218 | 227 | |
219 | 228 | function remove_child(Frame $child, $update_node = true) { |
220 | - while ( $child instanceof Frame_Decorator ) |
|
221 | - $child = $new_child->_frame; |
|
229 | + while ( $child instanceof Frame_Decorator ) { |
|
230 | + $child = $new_child->_frame; |
|
231 | + } |
|
222 | 232 | |
223 | 233 | $this->_frame->remove_child($child, $update_node); |
224 | 234 | } |
@@ -230,61 +240,71 @@ discard block |
||
230 | 240 | $p = $this->_frame->get_parent(); |
231 | 241 | |
232 | 242 | if ( $p && $deco = $p->get_decorator() ) { |
233 | - while ( $tmp = $deco->get_decorator() ) |
|
234 | - $deco = $tmp; |
|
243 | + while ( $tmp = $deco->get_decorator() ) { |
|
244 | + $deco = $tmp; |
|
245 | + } |
|
235 | 246 | return $deco; |
236 | - } else if ( $p ) |
|
237 | - return $p; |
|
238 | - else |
|
239 | - return null; |
|
247 | + } else if ( $p ) { |
|
248 | + return $p; |
|
249 | + } else { |
|
250 | + return null; |
|
251 | + } |
|
240 | 252 | } |
241 | 253 | |
242 | 254 | function get_first_child() { |
243 | 255 | $c = $this->_frame->get_first_child(); |
244 | 256 | if ( $c && $deco = $c->get_decorator() ) { |
245 | - while ( $tmp = $deco->get_decorator() ) |
|
246 | - $deco = $tmp; |
|
257 | + while ( $tmp = $deco->get_decorator() ) { |
|
258 | + $deco = $tmp; |
|
259 | + } |
|
247 | 260 | return $deco; |
248 | - } else if ( $c ) |
|
249 | - return $c; |
|
250 | - else |
|
251 | - return null; |
|
261 | + } else if ( $c ) { |
|
262 | + return $c; |
|
263 | + } else { |
|
264 | + return null; |
|
265 | + } |
|
252 | 266 | } |
253 | 267 | |
254 | 268 | function get_last_child() { |
255 | 269 | $c = $this->_frame->get_last_child(); |
256 | 270 | if ( $c && $deco = $c->get_decorator() ) { |
257 | - while ( $tmp = $deco->get_decorator() ) |
|
258 | - $deco = $tmp; |
|
271 | + while ( $tmp = $deco->get_decorator() ) { |
|
272 | + $deco = $tmp; |
|
273 | + } |
|
259 | 274 | return $deco; |
260 | - } else if ( $c ) |
|
261 | - return $c; |
|
262 | - else |
|
263 | - return null; |
|
275 | + } else if ( $c ) { |
|
276 | + return $c; |
|
277 | + } else { |
|
278 | + return null; |
|
279 | + } |
|
264 | 280 | } |
265 | 281 | |
266 | 282 | function get_prev_sibling() { |
267 | 283 | $s = $this->_frame->get_prev_sibling(); |
268 | 284 | if ( $s && $deco = $s->get_decorator() ) { |
269 | - while ( $tmp = $deco->get_decorator() ) |
|
270 | - $deco = $tmp; |
|
285 | + while ( $tmp = $deco->get_decorator() ) { |
|
286 | + $deco = $tmp; |
|
287 | + } |
|
271 | 288 | return $deco; |
272 | - } else if ( $s ) |
|
273 | - return $s; |
|
274 | - else |
|
275 | - return null; |
|
289 | + } else if ( $s ) { |
|
290 | + return $s; |
|
291 | + } else { |
|
292 | + return null; |
|
293 | + } |
|
276 | 294 | } |
277 | 295 | |
278 | 296 | function get_next_sibling() { |
279 | 297 | $s = $this->_frame->get_next_sibling(); |
280 | 298 | if ( $s && $deco = $s->get_decorator() ) { |
281 | - while ( $tmp = $deco->get_decorator() ) |
|
282 | - $deco = $tmp; |
|
299 | + while ( $tmp = $deco->get_decorator() ) { |
|
300 | + $deco = $tmp; |
|
301 | + } |
|
283 | 302 | return $deco; |
284 | - } else if ( $s ) |
|
285 | - return $s; |
|
286 | - else |
|
287 | - return null; |
|
303 | + } else if ( $s ) { |
|
304 | + return $s; |
|
305 | + } else { |
|
306 | + return null; |
|
307 | + } |
|
288 | 308 | } |
289 | 309 | |
290 | 310 | function get_children() { |
@@ -299,16 +319,18 @@ discard block |
||
299 | 319 | |
300 | 320 | function set_positioner(Positioner $posn) { |
301 | 321 | $this->_positioner = $posn; |
302 | - if ( $this->_frame instanceof Frame_Decorator ) |
|
303 | - $this->_frame->set_positioner($posn); |
|
322 | + if ( $this->_frame instanceof Frame_Decorator ) { |
|
323 | + $this->_frame->set_positioner($posn); |
|
324 | + } |
|
304 | 325 | } |
305 | 326 | |
306 | 327 | //........................................................................ |
307 | 328 | |
308 | 329 | function set_reflower(Frame_Reflower $reflower) { |
309 | 330 | $this->_reflower = $reflower; |
310 | - if ( $this->_frame instanceof Frame_Decorator ) |
|
311 | - $this->_frame->set_reflower( $reflower ); |
|
331 | + if ( $this->_frame instanceof Frame_Decorator ) { |
|
332 | + $this->_frame->set_reflower( $reflower ); |
|
333 | + } |
|
312 | 334 | } |
313 | 335 | |
314 | 336 | function get_reflower() { return $this->_reflower; } |
@@ -317,8 +339,9 @@ discard block |
||
317 | 339 | |
318 | 340 | function set_root(Frame $root) { |
319 | 341 | $this->_root = $root; |
320 | - if ( $this->_frame instanceof Frame_Decorator ) |
|
321 | - $this->_frame->set_root($root); |
|
342 | + if ( $this->_frame instanceof Frame_Decorator ) { |
|
343 | + $this->_frame->set_root($root); |
|
344 | + } |
|
322 | 345 | } |
323 | 346 | |
324 | 347 | function get_root() { return $this->_root; } |
@@ -331,8 +354,9 @@ discard block |
||
331 | 354 | $p = $this->get_parent(); |
332 | 355 | |
333 | 356 | while ( $p ) { |
334 | - if ( in_array($p->get_style()->display, Style::$BLOCK_TYPES) ) |
|
335 | - break; |
|
357 | + if ( in_array($p->get_style()->display, Style::$BLOCK_TYPES) ) { |
|
358 | + break; |
|
359 | + } |
|
336 | 360 | |
337 | 361 | $p = $p->get_parent(); |
338 | 362 | } |
@@ -358,8 +382,9 @@ discard block |
||
358 | 382 | return; |
359 | 383 | } |
360 | 384 | |
361 | - if ( $child->get_parent() !== $this ) |
|
362 | - throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
385 | + if ( $child->get_parent() !== $this ) { |
|
386 | + throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
387 | + } |
|
363 | 388 | |
364 | 389 | $split = $this->copy( $this->_frame->get_node()->cloneNode() ); |
365 | 390 | $split->reset(); |
@@ -74,14 +74,17 @@ discard block |
||
74 | 74 | list($x, $y) = $frame->get_position(); |
75 | 75 | $cb = $frame->get_containing_block(); |
76 | 76 | |
77 | - if ( ($ml = $style->margin_left) === "auto" || $ml === "none" ) |
|
78 | - $ml = 0; |
|
77 | + if ( ($ml = $style->margin_left) === "auto" || $ml === "none" ) { |
|
78 | + $ml = 0; |
|
79 | + } |
|
79 | 80 | |
80 | - if ( ($pl = $style->padding_left) === "auto" || $pl === "none" ) |
|
81 | - $pl = 0; |
|
81 | + if ( ($pl = $style->padding_left) === "auto" || $pl === "none" ) { |
|
82 | + $pl = 0; |
|
83 | + } |
|
82 | 84 | |
83 | - if ( ($bl = $style->border_left_width) === "auto" || $bl === "none" ) |
|
84 | - $bl = 0; |
|
85 | + if ( ($bl = $style->border_left_width) === "auto" || $bl === "none" ) { |
|
86 | + $bl = 0; |
|
87 | + } |
|
85 | 88 | |
86 | 89 | $x += $style->length_in_pt( array($ml, $pl, $bl), $cb["w"] ); |
87 | 90 | |
@@ -118,15 +121,17 @@ discard block |
||
118 | 121 | // our way down. |
119 | 122 | $p = $frame; |
120 | 123 | $stack = array(); |
121 | - while ( $p = $p->get_parent() ) |
|
122 | - $stack[] = $p; |
|
124 | + while ( $p = $p->get_parent() ) { |
|
125 | + $stack[] = $p; |
|
126 | + } |
|
123 | 127 | |
124 | 128 | while ( count($stack) > 0 ) { |
125 | 129 | $f = array_pop($stack); |
126 | 130 | |
127 | 131 | $deco_y = $y; |
128 | - if ( ($text_deco = $f->get_style()->text_decoration) === "none" ) |
|
129 | - continue; |
|
132 | + if ( ($text_deco = $f->get_style()->text_decoration) === "none" ) { |
|
133 | + continue; |
|
134 | + } |
|
130 | 135 | |
131 | 136 | $color = $f->get_style()->color; |
132 | 137 |
@@ -201,12 +201,13 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function __construct($paper = "letter", $orientation = "portrait") { |
203 | 203 | |
204 | - if ( is_array($paper) ) |
|
205 | - $size = $paper; |
|
206 | - else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) ) |
|
207 | - $size = self::$PAPER_SIZES[mb_strtolower($paper)]; |
|
208 | - else |
|
209 | - $size = self::$PAPER_SIZES["letter"]; |
|
204 | + if ( is_array($paper) ) { |
|
205 | + $size = $paper; |
|
206 | + } else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) ) { |
|
207 | + $size = self::$PAPER_SIZES[mb_strtolower($paper)]; |
|
208 | + } else { |
|
209 | + $size = self::$PAPER_SIZES["letter"]; |
|
210 | + } |
|
210 | 211 | |
211 | 212 | if ( mb_strtolower($orientation) === "landscape" ) { |
212 | 213 | $a = $size[3]; |
@@ -243,9 +244,12 @@ discard block |
||
243 | 244 | function __destruct() { |
244 | 245 | foreach ($this->_image_cache as $img) { |
245 | 246 | //debugpng |
246 | - if (DEBUGPNG) print '[__destruct unlink '.$img.']'; |
|
247 | - if (!DEBUGKEEPTEMP) |
|
248 | - unlink($img); |
|
247 | + if (DEBUGPNG) { |
|
248 | + print '[__destruct unlink '.$img.']'; |
|
249 | + } |
|
250 | + if (!DEBUGKEEPTEMP) { |
|
251 | + unlink($img); |
|
252 | + } |
|
249 | 253 | } |
250 | 254 | } |
251 | 255 | |
@@ -559,12 +563,14 @@ discard block |
||
559 | 563 | $this->_set_line_transparency($blend, $opacity); |
560 | 564 | $this->_set_fill_transparency($blend, $opacity); |
561 | 565 | |
562 | - if ( !$fill && isset($width) ) |
|
563 | - $this->_set_line_style($width, "square", "miter", $style); |
|
566 | + if ( !$fill && isset($width) ) { |
|
567 | + $this->_set_line_style($width, "square", "miter", $style); |
|
568 | + } |
|
564 | 569 | |
565 | 570 | // Adjust y values |
566 | - for ( $i = 1; $i < count($points); $i += 2) |
|
567 | - $points[$i] = $this->y($points[$i]); |
|
571 | + for ( $i = 1; $i < count($points); $i += 2) { |
|
572 | + $points[$i] = $this->y($points[$i]); |
|
573 | + } |
|
568 | 574 | |
569 | 575 | $this->_pdf->polygon($points, count($points) / 2, $fill); |
570 | 576 | } |
@@ -580,8 +586,9 @@ discard block |
||
580 | 586 | $this->_set_line_transparency($blend, $opacity); |
581 | 587 | $this->_set_fill_transparency($blend, $opacity); |
582 | 588 | |
583 | - if ( !$fill && isset($width) ) |
|
584 | - $this->_set_line_style($width, "round", "round", $style); |
|
589 | + if ( !$fill && isset($width) ) { |
|
590 | + $this->_set_line_style($width, "round", "round", $style); |
|
591 | + } |
|
585 | 592 | |
586 | 593 | $this->_pdf->ellipse($x, $this->y($y), $r1, 0, 0, 8, 0, 360, 1, $fill); |
587 | 594 | } |
@@ -590,7 +597,9 @@ discard block |
||
590 | 597 | |
591 | 598 | function image($img_url, $img_type, $x, $y, $w, $h) { |
592 | 599 | //debugpng |
593 | - if (DEBUGPNG) print '[image:'.$img_url.'|'.$img_type.']'; |
|
600 | + if (DEBUGPNG) { |
|
601 | + print '[image:'.$img_url.'|'.$img_type.']'; |
|
602 | + } |
|
594 | 603 | |
595 | 604 | $img_type = mb_strtolower($img_type); |
596 | 605 | |
@@ -598,14 +607,18 @@ discard block |
||
598 | 607 | case "jpeg": |
599 | 608 | case "jpg": |
600 | 609 | //debugpng |
601 | - if (DEBUGPNG) print '!!!jpg!!!'; |
|
610 | + if (DEBUGPNG) { |
|
611 | + print '!!!jpg!!!'; |
|
612 | + } |
|
602 | 613 | |
603 | 614 | $this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h); |
604 | 615 | break; |
605 | 616 | |
606 | 617 | case "png": |
607 | 618 | //debugpng |
608 | - if (DEBUGPNG) print '!!!png!!!'; |
|
619 | + if (DEBUGPNG) { |
|
620 | + print '!!!png!!!'; |
|
621 | + } |
|
609 | 622 | |
610 | 623 | $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h); |
611 | 624 | break; |
@@ -616,7 +629,9 @@ discard block |
||
616 | 629 | //if (0) { |
617 | 630 | if ( method_exists( $this->_pdf, "addImagePng" ) ) { |
618 | 631 | //debugpng |
619 | - if (DEBUGPNG) print '!!!gif addImagePng!!!'; |
|
632 | + if (DEBUGPNG) { |
|
633 | + print '!!!gif addImagePng!!!'; |
|
634 | + } |
|
620 | 635 | |
621 | 636 | //If optimization to direct png creation from gd object is available, |
622 | 637 | //don't create temp file, but place gd object directly into the pdf |
@@ -635,7 +650,9 @@ discard block |
||
635 | 650 | $this->_pdf->addImagePng($img_url, $x, $this->y($y) - $h, $w, $h, $img); |
636 | 651 | } else { |
637 | 652 | //debugpng |
638 | - if (DEBUGPNG) print '!!!gif addPngFromFile!!!'; |
|
653 | + if (DEBUGPNG) { |
|
654 | + print '!!!gif addPngFromFile!!!'; |
|
655 | + } |
|
639 | 656 | $img_url = $this->_convert_gif_to_png($img_url); |
640 | 657 | $this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h); |
641 | 658 | } |
@@ -643,7 +660,9 @@ discard block |
||
643 | 660 | |
644 | 661 | default: |
645 | 662 | //debugpng |
646 | - if (DEBUGPNG) print '!!!unknown!!!'; |
|
663 | + if (DEBUGPNG) { |
|
664 | + print '!!!unknown!!!'; |
|
665 | + } |
|
647 | 666 | break; |
648 | 667 | } |
649 | 668 | |
@@ -733,8 +752,9 @@ discard block |
||
733 | 752 | if ( strpos($url, '#') === 0 ) { |
734 | 753 | // Local link |
735 | 754 | $name = substr($url,1); |
736 | - if ( $name ) |
|
737 | - $this->_pdf->addInternalLink($name, $x, $y, $x + $width, $y + $height); |
|
755 | + if ( $name ) { |
|
756 | + $this->_pdf->addInternalLink($name, $x, $y, $x + $width, $y + $height); |
|
757 | + } |
|
738 | 758 | |
739 | 759 | } else { |
740 | 760 | $this->_pdf->addLink(rawurldecode($url), $x, $y, $x + $width, $y + $height); |
@@ -819,8 +839,9 @@ discard block |
||
819 | 839 | */ |
820 | 840 | protected function _add_page_text() { |
821 | 841 | |
822 | - if ( !count($this->_page_text) ) |
|
823 | - return; |
|
842 | + if ( !count($this->_page_text) ) { |
|
843 | + return; |
|
844 | + } |
|
824 | 845 | |
825 | 846 | $page_number = 1; |
826 | 847 | $eval = null; |
@@ -878,10 +899,11 @@ discard block |
||
878 | 899 | // Add page text |
879 | 900 | $this->_add_page_text(); |
880 | 901 | |
881 | - if ( isset($options["compress"]) && $options["compress"] != 1 ) |
|
882 | - $debug = 1; |
|
883 | - else |
|
884 | - $debug = 0; |
|
902 | + if ( isset($options["compress"]) && $options["compress"] != 1 ) { |
|
903 | + $debug = 1; |
|
904 | + } else { |
|
905 | + $debug = 0; |
|
906 | + } |
|
885 | 907 | |
886 | 908 | return $this->_pdf->output($debug); |
887 | 909 |