@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | |
62 | 62 | $cb = $this->_frame->get_containing_block(); |
63 | 63 | |
64 | - foreach ( $this->_frame->get_children() as $child) { |
|
64 | + foreach ($this->_frame->get_children() as $child) { |
|
65 | 65 | // Bail if the page is full |
66 | - if ( $page->is_full() ) |
|
66 | + if ($page->is_full()) |
|
67 | 67 | return; |
68 | 68 | |
69 | 69 | $child->set_containing_block($cb["x"], $cb["y"], $cb["w"], $cb["h"]); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | - if ( $page->is_full() ) |
|
77 | + if ($page->is_full()) |
|
78 | 78 | return; |
79 | 79 | |
80 | 80 | $cellmap = $table->get_cellmap(); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $this->_frame->set_position($cellmap->get_frame_position($this->_frame)); |
85 | 85 | |
86 | - if ( $table->get_style()->border_collapse === "collapse" ) |
|
86 | + if ($table->get_style()->border_collapse === "collapse") |
|
87 | 87 | // Unset our borders because our cells are now using them |
88 | 88 | $style->border_style = "none"; |
89 | 89 |
@@ -54,16 +54,16 @@ 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" ) { |
|
57 | + if (($bg = $style->background_color) !== "transparent") { |
|
58 | 58 | list($x, $y, $w, $h) = $frame->get_padding_box(); |
59 | - $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
|
59 | + $this->_canvas->filled_rectangle($x, $y, $w, $h, $style->background_color); |
|
60 | 60 | } |
61 | 61 | |
62 | - if ( ($url = $style->background_image) && $url !== "none" ) { |
|
62 | + if (($url = $style->background_image) && $url !== "none") { |
|
63 | 63 | $this->_background_image($url, $x, $y, $w, $h, $style); |
64 | 64 | } |
65 | 65 | |
66 | - if ( $style->border_collapse !== "collapse" ) { |
|
66 | + if ($style->border_collapse !== "collapse") { |
|
67 | 67 | $this->_render_border($frame, "bevel"); |
68 | 68 | return; |
69 | 69 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // Determine if this cell borders on the bottom of the table. If so, |
83 | 83 | // then we draw its bottom border. Otherwise the next row down will |
84 | 84 | // draw its top border instead. |
85 | - if (in_array( $num_rows - 1, $cells["rows"])) { |
|
85 | + if (in_array($num_rows - 1, $cells["rows"])) { |
|
86 | 86 | $draw_bottom = true; |
87 | 87 | $bottom_row = $cellmap->get_row($num_rows - 1); |
88 | 88 | } else |
@@ -90,27 +90,27 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | // Draw the horizontal borders |
93 | - foreach ( $cells["columns"] as $j ) { |
|
93 | + foreach ($cells["columns"] as $j) { |
|
94 | 94 | $bp = $cellmap->get_border_properties($i, $j); |
95 | 95 | |
96 | 96 | $y = $top_row["y"] - $bp["top"]["width"] / 2; |
97 | 97 | |
98 | 98 | $col = $cellmap->get_column($j); |
99 | 99 | $x = $col["x"] - $bp["left"]["width"] / 2; |
100 | - $w = $col["used-width"] + ($bp["left"]["width"] + $bp["right"]["width"] ) / 2; |
|
100 | + $w = $col["used-width"] + ($bp["left"]["width"] + $bp["right"]["width"]) / 2; |
|
101 | 101 | |
102 | - if ( $bp["top"]["style"] !== "none" && $bp["top"]["width"] > 0 ) { |
|
102 | + if ($bp["top"]["style"] !== "none" && $bp["top"]["width"] > 0) { |
|
103 | 103 | $widths = array($bp["top"]["width"], |
104 | 104 | $bp["right"]["width"], |
105 | 105 | $bp["bottom"]["width"], |
106 | 106 | $bp["left"]["width"]); |
107 | - $method = "_border_". $bp["top"]["style"]; |
|
107 | + $method = "_border_".$bp["top"]["style"]; |
|
108 | 108 | $this->$method($x, $y, $w, $bp["top"]["color"], $widths, "top", "square"); |
109 | 109 | } |
110 | 110 | |
111 | - if ( $draw_bottom ) { |
|
111 | + if ($draw_bottom) { |
|
112 | 112 | $bp = $cellmap->get_border_properties($num_rows - 1, $j); |
113 | - if ( $bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0 ) |
|
113 | + if ($bp["bottom"]["style"] === "none" || $bp["bottom"]["width"] <= 0) |
|
114 | 114 | continue; |
115 | 115 | |
116 | 116 | $y = $bottom_row["y"] + $bottom_row["height"] + $bp["bottom"]["width"] / 2; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $bp["right"]["width"], |
120 | 120 | $bp["bottom"]["width"], |
121 | 121 | $bp["left"]["width"]); |
122 | - $method = "_border_". $bp["bottom"]["style"]; |
|
122 | + $method = "_border_".$bp["bottom"]["style"]; |
|
123 | 123 | $this->$method($x, $y, $w, $bp["bottom"]["color"], $widths, "bottom", "square"); |
124 | 124 | |
125 | 125 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $draw_right = false; |
137 | 137 | |
138 | 138 | // Draw the vertical borders |
139 | - foreach ( $cells["rows"] as $i ) { |
|
139 | + foreach ($cells["rows"] as $i) { |
|
140 | 140 | $bp = $cellmap->get_border_properties($i, $j); |
141 | 141 | |
142 | 142 | $x = $left_col["x"] - $bp["left"]["width"] / 2; |
@@ -144,22 +144,22 @@ discard block |
||
144 | 144 | $row = $cellmap->get_row($i); |
145 | 145 | |
146 | 146 | $y = $row["y"] - $bp["top"]["width"] / 2; |
147 | - $h = $row["height"] + ($bp["top"]["width"] + $bp["bottom"]["width"])/ 2; |
|
147 | + $h = $row["height"] + ($bp["top"]["width"] + $bp["bottom"]["width"]) / 2; |
|
148 | 148 | |
149 | - if ( $bp["left"]["style"] !== "none" && $bp["left"]["width"] > 0 ) { |
|
149 | + if ($bp["left"]["style"] !== "none" && $bp["left"]["width"] > 0) { |
|
150 | 150 | |
151 | 151 | $widths = array($bp["top"]["width"], |
152 | 152 | $bp["right"]["width"], |
153 | 153 | $bp["bottom"]["width"], |
154 | 154 | $bp["left"]["width"]); |
155 | 155 | |
156 | - $method = "_border_" . $bp["left"]["style"]; |
|
156 | + $method = "_border_".$bp["left"]["style"]; |
|
157 | 157 | $this->$method($x, $y, $h, $bp["left"]["color"], $widths, "left", "square"); |
158 | 158 | } |
159 | 159 | |
160 | - if ( $draw_right ) { |
|
160 | + if ($draw_right) { |
|
161 | 161 | $bp = $cellmap->get_border_properties($i, $num_cols - 1); |
162 | - if ( $bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0 ) |
|
162 | + if ($bp["right"]["style"] === "none" || $bp["right"]["width"] <= 0) |
|
163 | 163 | continue; |
164 | 164 | |
165 | 165 | $x = $right_col["x"] + $right_col["used-width"] + $bp["right"]["width"] / 2; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $bp["bottom"]["width"], |
170 | 170 | $bp["left"]["width"]); |
171 | 171 | |
172 | - $method = "_border_" . $bp["right"]["style"]; |
|
172 | + $method = "_border_".$bp["right"]["style"]; |
|
173 | 173 | $this->$method($x, $y, $h, $bp["right"]["color"], $widths, "right", "square"); |
174 | 174 | |
175 | 175 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | function evaluate($code, $vars = array()) { |
57 | - if ( !DOMPDF_ENABLE_PHP ) |
|
57 | + if (!DOMPDF_ENABLE_PHP) |
|
58 | 58 | return; |
59 | 59 | |
60 | 60 | // Set up some variables for the inline code |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function build_tree() { |
137 | 137 | $html = $this->_dom->getElementsByTagName("html")->item(0); |
138 | - if ( is_null($html) ) |
|
138 | + if (is_null($html)) |
|
139 | 139 | $html = $this->_dom->firstChild; |
140 | 140 | |
141 | - if ( is_null($html) ) |
|
141 | + if (is_null($html)) |
|
142 | 142 | throw new DOMPDF_Exception("Requested HTML document contains no data."); |
143 | 143 | |
144 | 144 | $this->_root = $this->_build_tree_r($html); |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | |
161 | 161 | $frame = new Frame($node); |
162 | 162 | $id = $frame->get_id(); |
163 | - $this->_registry[ $id ] = $frame; |
|
163 | + $this->_registry[$id] = $frame; |
|
164 | 164 | |
165 | - if ( !$node->hasChildNodes() ) |
|
165 | + if (!$node->hasChildNodes()) |
|
166 | 166 | return $frame; |
167 | 167 | |
168 | 168 | // Fixes 'cannot access undefined property for object with |
@@ -177,40 +177,40 @@ discard block |
||
177 | 177 | |
178 | 178 | foreach ($children as $child) { |
179 | 179 | // Skip non-displaying nodes |
180 | - if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) ) { |
|
181 | - if ( mb_strtolower($child->nodeName) !== "head" && |
|
182 | - mb_strtolower($child->nodeName) !== "style" ) |
|
180 | + if (in_array(mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS)) { |
|
181 | + if (mb_strtolower($child->nodeName) !== "head" && |
|
182 | + mb_strtolower($child->nodeName) !== "style") |
|
183 | 183 | $child->parentNode->removeChild($child); |
184 | 184 | continue; |
185 | 185 | } |
186 | 186 | |
187 | 187 | // Skip empty text nodes |
188 | - if ( $child->nodeName === "#text" && $child->nodeValue == "" ) { |
|
188 | + if ($child->nodeName === "#text" && $child->nodeValue == "") { |
|
189 | 189 | $child->parentNode->removeChild($child); |
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | |
193 | 193 | // Skip empty image nodes |
194 | - if ( $child->nodeName === "img" && $child->getAttribute("src") == "" ) { |
|
194 | + if ($child->nodeName === "img" && $child->getAttribute("src") == "") { |
|
195 | 195 | $child->parentNode->removeChild($child); |
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | 199 | // Add a container frame for images |
200 | - if ( $child->nodeName === "img" ) { |
|
200 | + if ($child->nodeName === "img") { |
|
201 | 201 | $img_node = $child->ownerDocument->createElement("img_inner"); |
202 | 202 | |
203 | 203 | // Move attributes to inner node |
204 | - foreach ( $child->attributes as $attr => $attr_node ) { |
|
204 | + foreach ($child->attributes as $attr => $attr_node) { |
|
205 | 205 | // Skip style, but move all other attributes |
206 | - if ( $attr === "style" ) |
|
206 | + if ($attr === "style") |
|
207 | 207 | continue; |
208 | 208 | |
209 | 209 | $img_node->setAttribute($attr, $attr_node->value); |
210 | 210 | } |
211 | 211 | |
212 | - foreach ( $child->attributes as $attr => $node ) { |
|
213 | - if ( $attr === "style" ) |
|
212 | + foreach ($child->attributes as $attr => $node) { |
|
213 | + if ($attr === "style") |
|
214 | 214 | continue; |
215 | 215 | $child->removeAttribute($attr); |
216 | 216 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function split($child = null) { |
67 | 67 | |
68 | - if ( is_null($child) ) { |
|
68 | + if (is_null($child)) { |
|
69 | 69 | parent::split(); |
70 | 70 | return; |
71 | 71 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | $cellmap = $this->get_parent()->get_cellmap(); |
76 | 76 | $iter = $child; |
77 | 77 | |
78 | - while ( $iter ) { |
|
78 | + while ($iter) { |
|
79 | 79 | $cellmap->remove_row($iter); |
80 | 80 | $iter = $iter->get_next_sibling(); |
81 | 81 | } |
82 | 82 | |
83 | 83 | // If we are splitting at the first child remove the |
84 | 84 | // table-row-group from the cellmap as well |
85 | - if ( $child === $this->get_first_child() ) { |
|
85 | + if ($child === $this->get_first_child()) { |
|
86 | 86 | $cellmap->remove_row_group($this); |
87 | 87 | parent::split(); |
88 | 88 | return; |
@@ -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 |