Passed
Push — 1.10.x ( aae6b1...e5a590 )
by Yannick
131:05 queued 81:36
created
main/inc/lib/phpdocx/pdf/include/table_row_positioner.cls.php 1 patch
Indentation   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: table_row_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,22 +46,22 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Table_Row_Positioner extends Positioner {
49 48
 
50
-  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
49
+    function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
51 50
   
52
-  //........................................................................
51
+    //........................................................................
53 52
 
54
-  function position() {
53
+    function position() {
55 54
 
56 55
     $cb = $this->_frame->get_containing_block();    
57 56
     $p = $this->_frame->get_prev_sibling();
58 57
 
59 58
     if ( $p ) 
60
-      $y = $p->get_position("y") + $p->get_margin_height();
59
+        $y = $p->get_position("y") + $p->get_margin_height();
61 60
 
62 61
     else
63
-      $y = $cb["y"];
62
+        $y = $cb["y"];
64 63
 
65 64
     $this->_frame->set_position($cb["x"], $y);
66 65
 
67
-  }
66
+    }
68 67
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/page_frame_decorator.cls.php 1 patch
Indentation   +294 added lines, -295 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: page_frame_decorator.cls.php,v $
6
- * Created on: 2004-06-15
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: page_frame_decorator.cls.php,v $
6
+     * Created on: 2004-06-15
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: page_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -47,137 +46,137 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Page_Frame_Decorator extends Frame_Decorator {
49 48
 
50
-  /**
51
-   * y value of bottom page margin
52
-   *
53
-   * @var float
54
-   */
55
-  protected $_bottom_page_margin;
56
-
57
-  /**
58
-   * Flag indicating page is full.
59
-   *
60
-   * @var bool
61
-   */
62
-  protected $_page_full;
63
-
64
-  /**
65
-   * Number of tables currently being reflowed
66
-   *
67
-   * @var int
68
-   */
69
-  protected $_in_table;
70
-
71
-  /**
72
-   * The pdf renderer
73
-   *
74
-   * @var Renderer
75
-   */
76
-  protected $_renderer;
77
-
78
-  //........................................................................
79
-
80
-  /**
81
-   * Class constructor
82
-   *
83
-   * @param Frame $frame the frame to decorate
84
-   */
85
-  function __construct(Frame $frame, DOMPDF $dompdf) {
49
+    /**
50
+     * y value of bottom page margin
51
+     *
52
+     * @var float
53
+     */
54
+    protected $_bottom_page_margin;
55
+
56
+    /**
57
+     * Flag indicating page is full.
58
+     *
59
+     * @var bool
60
+     */
61
+    protected $_page_full;
62
+
63
+    /**
64
+     * Number of tables currently being reflowed
65
+     *
66
+     * @var int
67
+     */
68
+    protected $_in_table;
69
+
70
+    /**
71
+     * The pdf renderer
72
+     *
73
+     * @var Renderer
74
+     */
75
+    protected $_renderer;
76
+
77
+    //........................................................................
78
+
79
+    /**
80
+     * Class constructor
81
+     *
82
+     * @param Frame $frame the frame to decorate
83
+     */
84
+    function __construct(Frame $frame, DOMPDF $dompdf) {
86 85
     parent::__construct($frame, $dompdf);
87 86
     $this->_page_full = false;
88 87
     $this->_in_table = 0;
89 88
     $this->_bottom_page_margin = null;
90
-  }
89
+    }
91 90
 
92 91
 
93
-  /**
94
-   * Set the renderer used for this pdf
95
-   *
96
-   * @param Renderer $renderer the renderer to use
97
-   */
98
-  function set_renderer($renderer) {
92
+    /**
93
+     * Set the renderer used for this pdf
94
+     *
95
+     * @param Renderer $renderer the renderer to use
96
+     */
97
+    function set_renderer($renderer) {
99 98
     $this->_renderer = $renderer;
100
-  }
101
-
102
-  /**
103
-   * Return the renderer used for this pdf
104
-   *
105
-   * @return Renderer
106
-   */
107
-  function get_renderer() {
99
+    }
100
+
101
+    /**
102
+     * Return the renderer used for this pdf
103
+     *
104
+     * @return Renderer
105
+     */
106
+    function get_renderer() {
108 107
     return $this->_renderer;
109
-  }
110
-
111
-  /**
112
-   * Set the frame's containing block.  Overridden to set $this->_bottom_page_margin.
113
-   *
114
-   * @param float $x
115
-   * @param float $y
116
-   * @param float $w
117
-   * @param float $h
118
-   */
119
-  function set_containing_block($x = null, $y = null, $w = null, $h = null) {
108
+    }
109
+
110
+    /**
111
+     * Set the frame's containing block.  Overridden to set $this->_bottom_page_margin.
112
+     *
113
+     * @param float $x
114
+     * @param float $y
115
+     * @param float $w
116
+     * @param float $h
117
+     */
118
+    function set_containing_block($x = null, $y = null, $w = null, $h = null) {
120 119
     parent::set_containing_block($x,$y,$w,$h);
121 120
     $w = $this->get_containing_block("w");
122 121
     if ( isset($h) )
123
-      $this->_bottom_page_margin = $h; // - $this->_frame->get_style()->length_in_pt($this->_frame->get_style()->margin_bottom, $w);
124
-  }
125
-
126
-  /**
127
-   * Returns true if the page is full and is no longer accepting frames.
128
-   *
129
-   * @return bool
130
-   */
131
-  function is_full() {
122
+        $this->_bottom_page_margin = $h; // - $this->_frame->get_style()->length_in_pt($this->_frame->get_style()->margin_bottom, $w);
123
+    }
124
+
125
+    /**
126
+     * Returns true if the page is full and is no longer accepting frames.
127
+     *
128
+     * @return bool
129
+     */
130
+    function is_full() {
132 131
     return $this->_page_full;
133
-  }
132
+    }
134 133
 
135
-  /**
136
-   * Start a new page by resetting the full flag.
137
-   */
138
-  function next_page() {
134
+    /**
135
+     * Start a new page by resetting the full flag.
136
+     */
137
+    function next_page() {
139 138
     $this->_renderer->new_page();
140 139
     $this->_page_full = false;
141
-  }
140
+    }
142 141
 
143
-  /**
144
-   * Indicate to the page that a table is currently being reflowed.
145
-   */
146
-  function table_reflow_start() {
142
+    /**
143
+     * Indicate to the page that a table is currently being reflowed.
144
+     */
145
+    function table_reflow_start() {
147 146
     $this->_in_table++;
148
-  }
147
+    }
149 148
 
150
-  /**
151
-   * Indicate to the page that table reflow is finished.
152
-   */
153
-  function table_reflow_end() {
149
+    /**
150
+     * Indicate to the page that table reflow is finished.
151
+     */
152
+    function table_reflow_end() {
154 153
     $this->_in_table--;
155
-  }
156
-
157
-  /**
158
-   * Return whether we are currently in a nested table or not
159
-   *
160
-   * @return bool
161
-   */
162
-  function in_nested_table() {
154
+    }
155
+
156
+    /**
157
+     * Return whether we are currently in a nested table or not
158
+     *
159
+     * @return bool
160
+     */
161
+    function in_nested_table() {
163 162
     return $this->_in_table > 1;
164
-  }
163
+    }
165 164
   
166
-  /**
167
-   * Check if a forced page break is required before $frame.  This uses the
168
-   * frame's page_break_before property as well as the preceeding frame's
169
-   * page_break_after property.
170
-   *
171
-   * @link http://www.w3.org/TR/CSS21/page.html#forced
172
-   *
173
-   * @param Frame $frame the frame to check
174
-   * @return bool true if a page break occured
175
-   */
176
-  function check_forced_page_break(Frame $frame) {
165
+    /**
166
+     * Check if a forced page break is required before $frame.  This uses the
167
+     * frame's page_break_before property as well as the preceeding frame's
168
+     * page_break_after property.
169
+     *
170
+     * @link http://www.w3.org/TR/CSS21/page.html#forced
171
+     *
172
+     * @param Frame $frame the frame to check
173
+     * @return bool true if a page break occured
174
+     */
175
+    function check_forced_page_break(Frame $frame) {
177 176
 
178 177
     // Skip check if page is already split
179 178
     if ( $this->_page_full )
180
-      return;
179
+        return;
181 180
 
182 181
     $block_types = array("block", "list-item", "table");
183 182
     $page_breaks = array("always", "left", "right");
@@ -185,42 +184,42 @@  discard block
 block discarded – undo
185 184
     $style = $frame->get_style();
186 185
 
187 186
     if ( !in_array($style->display, $block_types) )
188
-      return false;
187
+        return false;
189 188
 
190 189
     // Find the previous block-level sibling
191 190
     $prev = $frame->get_prev_sibling();
192 191
     while ( $prev && !in_array($prev->get_style()->display, $block_types) )
193
-      $prev = $prev->get_prev_sibling();
192
+        $prev = $prev->get_prev_sibling();
194 193
 
195 194
     if ( in_array($style->page_break_before, $page_breaks) ) {
196 195
 
197
-      // Prevent cascading splits
198
-      $frame->split();
199
-      // We have to grab the style again here because split() resets
200
-      // $frame->style to the frame's orignal style.
201
-      $frame->get_style()->page_break_before = "auto";
202
-      $this->_page_full = true;
203
-      return true;
196
+        // Prevent cascading splits
197
+        $frame->split();
198
+        // We have to grab the style again here because split() resets
199
+        // $frame->style to the frame's orignal style.
200
+        $frame->get_style()->page_break_before = "auto";
201
+        $this->_page_full = true;
202
+        return true;
204 203
     }
205 204
 
206 205
     if ( ($prev && in_array($prev->get_style()->page_break_after, $page_breaks)) ) {
207
-      // Prevent cascading splits
208
-      $frame->split();
209
-      $prev->get_style()->page_break_after = "auto";
210
-      $this->_page_full = true;
211
-      return true;
206
+        // Prevent cascading splits
207
+        $frame->split();
208
+        $prev->get_style()->page_break_after = "auto";
209
+        $this->_page_full = true;
210
+        return true;
212 211
     }
213 212
 
214 213
     return false;
215
-  }
216
-
217
-  /**
218
-   * Determine if a page break is allowed before $frame
219
-   *
220
-   * @param Frame $frame the frame to check
221
-   * @return bool true if a break is allowed, false otherwise
222
-   */
223
-  protected function _page_break_allowed(Frame $frame) {
214
+    }
215
+
216
+    /**
217
+     * Determine if a page break is allowed before $frame
218
+     *
219
+     * @param Frame $frame the frame to check
220
+     * @return bool true if a break is allowed, false otherwise
221
+     */
222
+    protected function _page_break_allowed(Frame $frame) {
224 223
     /**
225 224
      *
226 225
      * http://www.w3.org/TR/CSS21/page.html#allowed-page-breaks
@@ -276,162 +275,162 @@  discard block
 block discarded – undo
276 275
     // Block Frames (1):
277 276
     if ( in_array($display, $block_types) ) {
278 277
 
279
-      // Avoid breaks within table-cells
280
-      if ( $this->_in_table ) {
278
+        // Avoid breaks within table-cells
279
+        if ( $this->_in_table ) {
281 280
         dompdf_debug("page-break", "In table: " . $this->_in_table);
282 281
         return false;
283
-      }
282
+        }
284 283
 
285
-      // Rules A & B
284
+        // Rules A & B
286 285
 
287
-      if ( $frame->get_style()->page_break_before === "avoid" ) {
286
+        if ( $frame->get_style()->page_break_before === "avoid" ) {
288 287
         dompdf_debug("page-break", "before: avoid");
289 288
         return false;
290
-      }
289
+        }
291 290
 
292
-      // Find the preceeding block-level sibling
293
-      $prev = $frame->get_prev_sibling();
294
-      while ( $prev && !in_array($prev->get_style()->display, $block_types) )
291
+        // Find the preceeding block-level sibling
292
+        $prev = $frame->get_prev_sibling();
293
+        while ( $prev && !in_array($prev->get_style()->display, $block_types) )
295 294
         $prev = $prev->get_prev_sibling();
296 295
 
297
-      // Does the previous element allow a page break after?
298
-      if ( $prev && $prev->get_style()->page_break_after === "avoid" ) {
296
+        // Does the previous element allow a page break after?
297
+        if ( $prev && $prev->get_style()->page_break_after === "avoid" ) {
299 298
         dompdf_debug("page-break", "after: avoid");
300 299
         return false;
301
-      }
300
+        }
302 301
 
303
-      // If both $prev & $frame have the same parent, check the parent's
304
-      // page_break_inside property.
305
-      $parent = $frame->get_parent();
306
-      if ( $prev && $parent && $parent->get_style()->page_break_inside === "avoid" ) {
307
-          dompdf_debug("page-break", "parent inside: avoid");
302
+        // If both $prev & $frame have the same parent, check the parent's
303
+        // page_break_inside property.
304
+        $parent = $frame->get_parent();
305
+        if ( $prev && $parent && $parent->get_style()->page_break_inside === "avoid" ) {
306
+            dompdf_debug("page-break", "parent inside: avoid");
308 307
         return false;
309
-      }
308
+        }
310 309
 
311
-      // To prevent cascading page breaks when a top-level element has
312
-      // page-break-inside: avoid, ensure that at least one frame is
313
-      // on the page before splitting.
314
-      if ( $parent->get_node()->nodeName === "body" && !$prev ) {
310
+        // To prevent cascading page breaks when a top-level element has
311
+        // page-break-inside: avoid, ensure that at least one frame is
312
+        // on the page before splitting.
313
+        if ( $parent->get_node()->nodeName === "body" && !$prev ) {
315 314
         // We are the body's first child
316
-          dompdf_debug("page-break", "Body's first child.");
315
+            dompdf_debug("page-break", "Body's first child.");
317 316
         return false;
318
-      }
317
+        }
319 318
 
320
-      // If the frame is the first block-level frame, use the value from
321
-      // $frame's parent instead.
322
-      if ( !$prev && $parent )
319
+        // If the frame is the first block-level frame, use the value from
320
+        // $frame's parent instead.
321
+        if ( !$prev && $parent )
323 322
         return $this->_page_break_allowed( $parent );
324 323
 
325
-      dompdf_debug("page-break", "block: break allowed");
326
-      return true;
324
+        dompdf_debug("page-break", "block: break allowed");
325
+        return true;
327 326
 
328 327
     }
329 328
 
330 329
     // Inline frames (2):
331 330
     else if ( in_array($display, Style::$INLINE_TYPES) ) {
332 331
 
333
-      // Avoid breaks within table-cells
334
-      if ( $this->_in_table ) {
335
-          dompdf_debug("page-break", "In table: " . $this->_in_table);
332
+        // Avoid breaks within table-cells
333
+        if ( $this->_in_table ) {
334
+            dompdf_debug("page-break", "In table: " . $this->_in_table);
336 335
         return false;
337
-      }
336
+        }
338 337
 
339
-      // Rule C
340
-      $block_parent = $frame->find_block_parent();
341
-      if ( count($block_parent->get_lines() ) < $frame->get_style()->orphans ) {
342
-          dompdf_debug("page-break", "orphans");
338
+        // Rule C
339
+        $block_parent = $frame->find_block_parent();
340
+        if ( count($block_parent->get_lines() ) < $frame->get_style()->orphans ) {
341
+            dompdf_debug("page-break", "orphans");
343 342
         return false;
344
-      }
343
+        }
345 344
 
346
-      // FIXME: Checking widows is tricky without having laid out the
347
-      // remaining line boxes.  Just ignore it for now...
345
+        // FIXME: Checking widows is tricky without having laid out the
346
+        // remaining line boxes.  Just ignore it for now...
348 347
 
349
-      // Rule D
350
-      $p = $block_parent;
351
-      while ($p) {
348
+        // Rule D
349
+        $p = $block_parent;
350
+        while ($p) {
352 351
         if ( $p->get_style()->page_break_inside === "avoid" ) {
353
-          dompdf_debug("page-break", "parent->inside: avoid");
354
-          return false;
352
+            dompdf_debug("page-break", "parent->inside: avoid");
353
+            return false;
355 354
         }
356 355
         $p = $p->find_block_parent();
357
-      }
356
+        }
358 357
 
359
-      // To prevent cascading page breaks when a top-level element has
360
-      // page-break-inside: avoid, ensure that at least one frame with
361
-      // some content is on the page before splitting.
362
-      $prev = $frame->get_prev_sibling();
363
-      while ( $prev && ($prev->get_node()->nodeName === "#text" && trim($prev->get_node()->nodeValue) == "") )
358
+        // To prevent cascading page breaks when a top-level element has
359
+        // page-break-inside: avoid, ensure that at least one frame with
360
+        // some content is on the page before splitting.
361
+        $prev = $frame->get_prev_sibling();
362
+        while ( $prev && ($prev->get_node()->nodeName === "#text" && trim($prev->get_node()->nodeValue) == "") )
364 363
         $prev = $prev->get_prev_sibling();
365 364
 
366
-      if ( $block_parent->get_node()->nodeName === "body" && !$prev ) {
365
+        if ( $block_parent->get_node()->nodeName === "body" && !$prev ) {
367 366
         // We are the body's first child
368
-          dompdf_debug("page-break", "Body's first child.");
367
+            dompdf_debug("page-break", "Body's first child.");
369 368
         return false;
370
-      }
369
+        }
371 370
 
372
-      // Skip breaks on empty text nodes
373
-      if ( $frame->get_node()->nodeName === "#text" &&
371
+        // Skip breaks on empty text nodes
372
+        if ( $frame->get_node()->nodeName === "#text" &&
374 373
            $frame->get_node()->nodeValue == "" )
375 374
         return false;
376 375
 
377
-      dompdf_debug("page-break", "inline: break allowed");
378
-      return true;
376
+        dompdf_debug("page-break", "inline: break allowed");
377
+        return true;
379 378
 
380 379
     // Table-rows
381 380
     } else if ( $display === "table-row" ) {
382 381
 
383
-      // Simply check if the parent table's page_break_inside property is
384
-      // not 'avoid'
385
-      $p = Table_Frame_Decorator::find_parent_table($frame);
382
+        // Simply check if the parent table's page_break_inside property is
383
+        // not 'avoid'
384
+        $p = Table_Frame_Decorator::find_parent_table($frame);
386 385
 
387
-      while ($p) {
386
+        while ($p) {
388 387
         if ( $p->get_style()->page_break_inside === "avoid" ) {
389
-          dompdf_debug("page-break", "parent->inside: avoid");
390
-          return false;
388
+            dompdf_debug("page-break", "parent->inside: avoid");
389
+            return false;
391 390
         }
392 391
         $p = $p->find_block_parent();
393
-      }
392
+        }
394 393
 
395
-      // Avoid breaking after the first row of a table
396
-      if ( $p && $p->get_first_child() === $frame) {
397
-         dompdf_debug("page-break", "table: first-row");
394
+        // Avoid breaking after the first row of a table
395
+        if ( $p && $p->get_first_child() === $frame) {
396
+            dompdf_debug("page-break", "table: first-row");
398 397
         return false;
399
-      }
398
+        }
400 399
 
401
-      // If this is a nested table, prevent the page from breaking
402
-      if ( $this->_in_table > 1 ) {
400
+        // If this is a nested table, prevent the page from breaking
401
+        if ( $this->_in_table > 1 ) {
403 402
         dompdf_debug("page-break", "table: nested table");
404 403
         return false;
405
-      }
404
+        }
406 405
 
407
-      dompdf_debug("page-break","table-row/row-groups: break allowed");
408
-      return true;
406
+        dompdf_debug("page-break","table-row/row-groups: break allowed");
407
+        return true;
409 408
 
410 409
     } else if ( in_array($display, Table_Frame_Decorator::$ROW_GROUPS) ) {
411 410
 
412
-      // Disallow breaks at row-groups: only split at row boundaries
413
-      return false;
411
+        // Disallow breaks at row-groups: only split at row boundaries
412
+        return false;
414 413
 
415 414
     } else {
416 415
 
417
-      dompdf_debug("page-break", "? " . $frame->get_style()->display . "");
418
-      return false;
416
+        dompdf_debug("page-break", "? " . $frame->get_style()->display . "");
417
+        return false;
418
+    }
419
+
419 420
     }
420 421
 
421
-  }
422
-
423
-  /**
424
-   * Check if $frame will fit on the page.  If the frame does not fit,
425
-   * the frame tree is modified so that a page break occurs in the
426
-   * correct location.
427
-   *
428
-   * @param Frame $frame the frame to check
429
-   * @return Frame the frame following the page break
430
-   */
431
-  function check_page_break(Frame $frame) {
422
+    /**
423
+     * Check if $frame will fit on the page.  If the frame does not fit,
424
+     * the frame tree is modified so that a page break occurs in the
425
+     * correct location.
426
+     *
427
+     * @param Frame $frame the frame to check
428
+     * @return Frame the frame following the page break
429
+     */
430
+    function check_page_break(Frame $frame) {
432 431
     // Do not split if we have already
433 432
     if ( $this->_page_full )
434
-      return false;
433
+        return false;
435 434
 
436 435
     // Determine the frame's maximum y value
437 436
     $max_y = $frame->get_position("y") + $frame->get_margin_height();
@@ -440,18 +439,18 @@  discard block
 block discarded – undo
440 439
     // parents of $frame must fit on the page as well:
441 440
     $p = $frame->get_parent();
442 441
     while ( $p ) {
443
-      $style = $p->get_style();
444
-      $max_y += $style->length_in_pt(array($style->margin_bottom,
445
-                                           $style->padding_bottom,
446
-                                           $style->border_bottom_width));
447
-      $p = $p->get_parent();
442
+        $style = $p->get_style();
443
+        $max_y += $style->length_in_pt(array($style->margin_bottom,
444
+                                            $style->padding_bottom,
445
+                                            $style->border_bottom_width));
446
+        $p = $p->get_parent();
448 447
     }
449 448
 
450 449
 
451 450
     // Check if $frame flows off the page
452 451
     if ( $max_y <= $this->_bottom_page_margin )
453
-      // no: do nothing
454
-      return false;
452
+        // no: do nothing
453
+        return false;
455 454
 
456 455
     dompdf_debug("page-break", "check_page_break");
457 456
     dompdf_debug("page-break", "in_table: " . $this->_in_table);
@@ -466,58 +465,58 @@  discard block
 block discarded – undo
466 465
     dompdf_debug("page-break","Starting search");
467 466
     while ( $iter ) {
468 467
 //       echo "\nbacktrack: " .$iter->get_node()->nodeName ." ".spl_object_hash($iter->get_node()). "";
469
-      if ( $iter === $this ) {
470
-         dompdf_debug("page-break", "reached root.");
468
+        if ( $iter === $this ) {
469
+            dompdf_debug("page-break", "reached root.");
471 470
         // We've reached the root in our search.  Just split at $frame.
472 471
         break;
473
-      }
472
+        }
474 473
 
475
-      if ( $this->_page_break_allowed($iter) ) {
474
+        if ( $this->_page_break_allowed($iter) ) {
476 475
         dompdf_debug("page-break","break allowed, splitting.");
477 476
         $iter->split();
478 477
         $this->_page_full = true;
479 478
         $this->_in_table = $in_table;
480 479
         return true;
481
-      }
480
+        }
482 481
 
483
-      if ( !$flg && $next = $iter->get_last_child() ) {
484
-         dompdf_debug("page-break", "following last child.");
482
+        if ( !$flg && $next = $iter->get_last_child() ) {
483
+            dompdf_debug("page-break", "following last child.");
485 484
 
486 485
         if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) )
487
-          $this->_in_table++;
486
+            $this->_in_table++;
488 487
 
489 488
         $iter = $next;
490 489
         continue;
491
-      }
490
+        }
492 491
 
493
-      if ( $next = $iter->get_prev_sibling() ) {
494
-         dompdf_debug("page-break", "following prev sibling.");
492
+        if ( $next = $iter->get_prev_sibling() ) {
493
+            dompdf_debug("page-break", "following prev sibling.");
495 494
 
496 495
         if ( in_array($next->get_style()->display, Style::$TABLE_TYPES) &&
497 496
              !in_array($iter->get_style()->display, Style::$TABLE_TYPES) )
498
-          $this->_in_table++;
497
+            $this->_in_table++;
499 498
 
500 499
         else if ( !in_array($next->get_style()->display, Style::$TABLE_TYPES) &&
501 500
                   in_array($iter->get_style()->display, Style::$TABLE_TYPES) )
502
-          $this->_in_table--;
501
+            $this->_in_table--;
503 502
 
504 503
         $iter = $next;
505 504
         $flg = false;
506 505
         continue;
507
-      }
506
+        }
508 507
 
509
-      if ( $next = $iter->get_parent() ) {
510
-         dompdf_debug("page-break", "following parent.");
508
+        if ( $next = $iter->get_parent() ) {
509
+            dompdf_debug("page-break", "following parent.");
511 510
 
512 511
         if ( in_array($iter->get_style()->display, Style::$TABLE_TYPES) )
513
-          $this->_in_table--;
512
+            $this->_in_table--;
514 513
 
515 514
         $iter = $next;
516 515
         $flg = true;
517 516
         continue;
518
-      }
517
+        }
519 518
 
520
-      break;
519
+        break;
521 520
 
522 521
     }
523 522
 
@@ -528,33 +527,33 @@  discard block
 block discarded – undo
528 527
 
529 528
     // If we are in a table, backtrack to the nearest top-level table row
530 529
     if ( $this->_in_table ) {
531
-      $num_tables = $this->_in_table - 1;
530
+        $num_tables = $this->_in_table - 1;
532 531
 
533
-      $iter = $frame;
534
-      while ( $iter && $num_tables && $iter->get_style->display !== "table" ) {
532
+        $iter = $frame;
533
+        while ( $iter && $num_tables && $iter->get_style->display !== "table" ) {
535 534
         $iter = $iter->get_parent();
536 535
         $num_tables--;
537
-      }
536
+        }
538 537
 
539
-      $iter = $frame;
540
-      while ($iter && $iter->get_style()->display !== "table-row" )
538
+        $iter = $frame;
539
+        while ($iter && $iter->get_style()->display !== "table-row" )
541 540
         $iter = $iter->get_parent();
542 541
 
543
-      $iter->split();
544
-      $this->_page_full = true;
545
-      return true;
542
+        $iter->split();
543
+        $this->_page_full = true;
544
+        return true;
546 545
     }
547 546
 
548 547
     $frame->split();
549 548
     $this->_page_full = true;
550 549
     return true;
551 550
 
552
-  }
551
+    }
553 552
 
554
-  //........................................................................
553
+    //........................................................................
555 554
 
556
-  function split($frame = null) {
555
+    function split($frame = null) {
557 556
     // Do nothing
558
-  }
557
+    }
559 558
 
560 559
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/absolute_positioner.cls.php 1 patch
Indentation   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id */
@@ -44,9 +43,9 @@  discard block
 block discarded – undo
44 43
  */
45 44
 class Absolute_Positioner extends Positioner {
46 45
 
47
-  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
46
+    function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
48 47
 
49
-  function position() {
48
+    function position() {
50 49
 
51 50
     $cb = $this->_frame->get_containing_block();
52 51
 
@@ -61,27 +60,27 @@  discard block
 block discarded – undo
61 60
 
62 61
     if ( $p ) {
63 62
 
64
-      // Get the parent's padding box (see http://www.w3.org/TR/CSS21/visuren.html#propdef-top)
63
+        // Get the parent's padding box (see http://www.w3.org/TR/CSS21/visuren.html#propdef-top)
65 64
 
66
-      list($x, $y, $w, $h) = $p->get_padding_box();
65
+        list($x, $y, $w, $h) = $p->get_padding_box();
67 66
 
68 67
     } else {
69 68
 
70
-      $x = $cb["x"];
71
-      $y = $cb["y"];
69
+        $x = $cb["x"];
70
+        $y = $cb["y"];
72 71
 
73 72
     }
74 73
 
75 74
     if ( isset($top) ) {
76
-      $y += $top;
75
+        $y += $top;
77 76
     } else if ( isset($bottom) ) {
78
-      // FIXME: need to know this frame's height before we can do this correctly
77
+        // FIXME: need to know this frame's height before we can do this correctly
79 78
     }
80 79
 
81 80
     $x += $left;
82 81
 
83 82
     $this->_frame->set_position($x, $y);
84 83
 
85
-  }
84
+    }
86 85
 
87 86
 }
88 87
\ No newline at end of file
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_frame_reflower.cls.php 1 patch
Indentation   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: inline_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,11 +46,11 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Inline_Frame_Reflower extends Frame_Reflower {
49 48
 
50
-  function __construct(Frame $frame) { parent::__construct($frame); }
49
+    function __construct(Frame $frame) { parent::__construct($frame); }
51 50
   
52
-  //........................................................................
51
+    //........................................................................
53 52
 
54
-  function reflow() {
53
+    function reflow() {
55 54
     $style = $this->_frame->get_style();
56 55
     $this->_frame->position();
57 56
 
@@ -59,23 +58,23 @@  discard block
 block discarded – undo
59 58
 
60 59
     // Add our margin, padding & border to the first and last children
61 60
     if ( ($f = $this->_frame->get_first_child()) && $f instanceof Text_Frame_Decorator ) {
62
-      $f->get_style()->margin_left = $style->margin_left;
63
-      $f->get_style()->padding_left = $style->padding_left;
64
-      $f->get_style()->border_left = $style->border_left;
61
+        $f->get_style()->margin_left = $style->margin_left;
62
+        $f->get_style()->padding_left = $style->padding_left;
63
+        $f->get_style()->border_left = $style->border_left;
65 64
     }
66 65
 
67 66
     if ( ($l = $this->_frame->get_last_child()) && $l instanceof Text_Frame_Decorator ) {
68
-      $f->get_style()->margin_right = $style->margin_right;
69
-      $f->get_style()->padding_right = $style->padding_right;
70
-      $f->get_style()->border_right = $style->border_right;
67
+        $f->get_style()->margin_right = $style->margin_right;
68
+        $f->get_style()->padding_right = $style->padding_right;
69
+        $f->get_style()->border_right = $style->border_right;
71 70
     }
72 71
 
73 72
     // Set the containing blocks and reflow each child.  The containing
74 73
     // block is not changed by line boxes.
75 74
     foreach ( $this->_frame->get_children() as $child ) {
76 75
       
77
-      $child->set_containing_block($cb);
78
-      $child->reflow();
76
+        $child->set_containing_block($cb);
77
+        $child->reflow();
78
+    }
79 79
     }
80
-  }
81 80
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/cached_pdf_decorator.cls.php 1 patch
Indentation   +96 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: cached_pdf_decorator.cls.php,v $
6
- * Created on: 2004-07-23
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: cached_pdf_decorator.cls.php,v $
6
+     * Created on: 2004-07-23
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: cached_pdf_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -53,90 +52,90 @@  discard block
 block discarded – undo
53 52
  * @package dompdf
54 53
  */
55 54
 class Cached_PDF_Decorator extends CPDF_Adapter implements Canvas {
56
-  protected $_pdf;
57
-  protected $_cache_id;
58
-  protected $_current_page_id;
59
-  protected $_fonts;  // fonts used in this document
55
+    protected $_pdf;
56
+    protected $_cache_id;
57
+    protected $_current_page_id;
58
+    protected $_fonts;  // fonts used in this document
60 59
   
61
-  function __construct($cache_id, CPDF_Adapter $pdf) {
60
+    function __construct($cache_id, CPDF_Adapter $pdf) {
62 61
     $this->_pdf = $pdf;
63 62
     $this->_cache_id = $cache_id;
64 63
     $this->_fonts = array();
65 64
     
66 65
     $this->_current_page_id = $this->_pdf->open_object();
67
-  }
66
+    }
68 67
 
69
-  //........................................................................
68
+    //........................................................................
70 69
 
71
-  function get_cpdf() { return $this->_pdf->get_cpdf(); }
70
+    function get_cpdf() { return $this->_pdf->get_cpdf(); }
72 71
 
73
-  function open_object() { $this->_pdf->open_object(); }
74
-  function reopen_object() { return $this->_pdf->reopen_object(); }
72
+    function open_object() { $this->_pdf->open_object(); }
73
+    function reopen_object() { return $this->_pdf->reopen_object(); }
75 74
   
76
-  function close_object() { $this->_pdf->close_object(); }
75
+    function close_object() { $this->_pdf->close_object(); }
77 76
 
78
-  function add_object($object, $where = 'all') { $this->_pdf->add_object($object, $where); }
77
+    function add_object($object, $where = 'all') { $this->_pdf->add_object($object, $where); }
79 78
 
80
-  function serialize_object($id) { $this->_pdf->serialize_object($id); }
79
+    function serialize_object($id) { $this->_pdf->serialize_object($id); }
81 80
 
82
-  function reopen_serialized_object($obj) { $this->_pdf->reopen_serialized_object($obj); }
81
+    function reopen_serialized_object($obj) { $this->_pdf->reopen_serialized_object($obj); }
83 82
     
84
-  //........................................................................
83
+    //........................................................................
85 84
 
86
-  function get_width() { return $this->_pdf->get_width(); }
87
-  function get_height() {  return $this->_pdf->get_height(); }
88
-  function get_page_number() { return $this->_pdf->get_page_number(); }
89
-  function get_page_count() { return $this->_pdf->get_page_count(); }
85
+    function get_width() { return $this->_pdf->get_width(); }
86
+    function get_height() {  return $this->_pdf->get_height(); }
87
+    function get_page_number() { return $this->_pdf->get_page_number(); }
88
+    function get_page_count() { return $this->_pdf->get_page_count(); }
90 89
 
91
-  function set_page_number($num) { $this->_pdf->set_page_number($num); }
92
-  function set_page_count($count) { $this->_pdf->set_page_count($count); }
90
+    function set_page_number($num) { $this->_pdf->set_page_number($num); }
91
+    function set_page_count($count) { $this->_pdf->set_page_count($count); }
93 92
 
94
-  function line($x1, $y1, $x2, $y2, $color, $width, $style = array()) {
93
+    function line($x1, $y1, $x2, $y2, $color, $width, $style = array()) {
95 94
     $this->_pdf->line($x1, $y1, $x2, $y2, $color, $width, $style);
96
-  }
95
+    }
97 96
                               
98
-  function rectangle($x1, $y1, $w, $h, $color, $width, $style = array()) {
97
+    function rectangle($x1, $y1, $w, $h, $color, $width, $style = array()) {
99 98
     $this->_pdf->rectangle($x1, $y1, $w, $h, $color, $width, $style);
100
-  }
99
+    }
101 100
  
102
-  function filled_rectangle($x1, $y1, $w, $h, $color) {
101
+    function filled_rectangle($x1, $y1, $w, $h, $color) {
103 102
     $this->_pdf->filled_rectangle($x1, $y1, $w, $h, $color);
104
-  }
103
+    }
105 104
     
106
-  function polygon($points, $color, $width = null, $style = array(), $fill = false) {
105
+    function polygon($points, $color, $width = null, $style = array(), $fill = false) {
107 106
     $this->_pdf->polygon($points, $color, $width, $style, $fill);
108
-  }
107
+    }
109 108
 
110
-  function circle($x, $y, $r1, $color, $width = null, $style = null, $fill = false) {
109
+    function circle($x, $y, $r1, $color, $width = null, $style = null, $fill = false) {
111 110
     $this->_pdf->circle($x, $y, $r1, $color, $width, $style, $fill);
112
-  }
111
+    }
113 112
 
114
-  function image($img_url, $x, $y, $w = null, $h = null) {
113
+    function image($img_url, $x, $y, $w = null, $h = null) {
115 114
     $this->_pdf->image($img_url, $x, $y, $w, $h);
116
-  }
115
+    }
117 116
   
118
-  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
117
+    function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
119 118
     $this->_fonts[$font] = true;
120 119
     $this->_pdf->text($x, $y, $text, $font, $size, $color, $adjust, $angle);
121
-  }
120
+    }
122 121
 
123
-  function page_text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
122
+    function page_text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
124 123
     
125 124
     // We want to remove this from cached pages since it may not be correct
126 125
     $this->_pdf->close_object();
127 126
     $this->_pdf->page_text($x, $y, $text, $font, $size, $color, $adjust, $angle);
128 127
     $this->_pdf->reopen_object($this->_current_page_id);
129
-  }
128
+    }
130 129
   
131
-  function page_script($script, $type = 'text/php') {
130
+    function page_script($script, $type = 'text/php') {
132 131
     
133 132
     // We want to remove this from cached pages since it may not be correct
134 133
     $this->_pdf->close_object();
135 134
     $this->_pdf->page_script($script, $type);
136 135
     $this->_pdf->reopen_object($this->_current_page_id);
137
-  }
136
+    }
138 137
   
139
-  function new_page() {
138
+    function new_page() {
140 139
     $this->_pdf->close_object();
141 140
 
142 141
     // Add the object to the current page
@@ -144,43 +143,43 @@  discard block
 block discarded – undo
144 143
     $this->_pdf->new_page();    
145 144
 
146 145
     Page_Cache::store_page($this->_cache_id,
147
-                           $this->_pdf->get_page_number() - 1,
148
-                           $this->_pdf->serialize_object($this->_current_page_id));
146
+                            $this->_pdf->get_page_number() - 1,
147
+                            $this->_pdf->serialize_object($this->_current_page_id));
149 148
 
150 149
     $this->_current_page_id = $this->_pdf->open_object();
151 150
     return $this->_current_page_id;
152
-  }
151
+    }
153 152
   
154
-  function stream($filename) {
153
+    function stream($filename) {
155 154
     // Store the last page in the page cache
156 155
     if ( !is_null($this->_current_page_id) ) {
157
-      $this->_pdf->close_object();
158
-      $this->_pdf->add_object($this->_current_page_id, "add");
159
-      Page_Cache::store_page($this->_cache_id,
160
-                             $this->_pdf->get_page_number(),
161
-                             $this->_pdf->serialize_object($this->_current_page_id));
162
-      Page_Cache::store_fonts($this->_cache_id, $this->_fonts);
163
-      $this->_current_page_id = null;
156
+        $this->_pdf->close_object();
157
+        $this->_pdf->add_object($this->_current_page_id, "add");
158
+        Page_Cache::store_page($this->_cache_id,
159
+                                $this->_pdf->get_page_number(),
160
+                                $this->_pdf->serialize_object($this->_current_page_id));
161
+        Page_Cache::store_fonts($this->_cache_id, $this->_fonts);
162
+        $this->_current_page_id = null;
164 163
     }
165 164
     
166 165
     $this->_pdf->stream($filename);
167 166
     
168
-  }
167
+    }
169 168
   
170
-  function &output() {
169
+    function &output() {
171 170
     // Store the last page in the page cache
172 171
     if ( !is_null($this->_current_page_id) ) {
173
-      $this->_pdf->close_object();
174
-      $this->_pdf->add_object($this->_current_page_id, "add");
175
-      Page_Cache::store_page($this->_cache_id,
176
-                             $this->_pdf->get_page_number(),
177
-                             $this->_pdf->serialize_object($this->_current_page_id));
178
-      $this->_current_page_id = null;
172
+        $this->_pdf->close_object();
173
+        $this->_pdf->add_object($this->_current_page_id, "add");
174
+        Page_Cache::store_page($this->_cache_id,
175
+                                $this->_pdf->get_page_number(),
176
+                                $this->_pdf->serialize_object($this->_current_page_id));
177
+        $this->_current_page_id = null;
179 178
     }
180 179
     
181 180
     return $this->_pdf->output();
182
-  }
181
+    }
183 182
   
184
-  function get_messages() { return $this->_pdf->get_messages(); }
183
+    function get_messages() { return $this->_pdf->get_messages(); }
185 184
   
186 185
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/tcpdf_adapter.cls.php 1 patch
Indentation   +328 added lines, -329 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: tcpdf_adapter.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */
@@ -57,98 +56,98 @@  discard block
 block discarded – undo
57 56
  */
58 57
 class TCPDF_Adapter implements Canvas {
59 58
 
60
-  /**
61
-   * Dimensions of paper sizes in points
62
-   *
63
-   * @var array;
64
-   */
65
-  static public $PAPER_SIZES = array(); // Set to
59
+    /**
60
+     * Dimensions of paper sizes in points
61
+     *
62
+     * @var array;
63
+     */
64
+    static public $PAPER_SIZES = array(); // Set to
66 65
                                         // CPDF_Adapter::$PAPER_SIZES below.
67 66
 
68 67
 
69
-  /**
70
-   * Instance of the TCPDF class
71
-   *
72
-   * @var TCPDF
73
-   */
74
-  private $_pdf;
75
-
76
-  /**
77
-   * PDF width in points
78
-   *
79
-   * @var float
80
-   */
81
-  private $_width;
82
-
83
-  /**
84
-   * PDF height in points
85
-   *
86
-   * @var float
87
-   */
88
-  private $_height;
89
-
90
-  /**
91
-   * Last fill colour used
92
-   *
93
-   * @var array
94
-   */
95
-  private $_last_fill_color;
96
-
97
-  /**
98
-   * Last stroke colour used
99
-   *
100
-   * @var array
101
-   */
102
-  private $_last_stroke_color;
103
-
104
-  /**
105
-   * Last line width used
106
-   *
107
-   * @var float
108
-   */
109
-  private $_last_line_width;
68
+    /**
69
+     * Instance of the TCPDF class
70
+     *
71
+     * @var TCPDF
72
+     */
73
+    private $_pdf;
74
+
75
+    /**
76
+     * PDF width in points
77
+     *
78
+     * @var float
79
+     */
80
+    private $_width;
81
+
82
+    /**
83
+     * PDF height in points
84
+     *
85
+     * @var float
86
+     */
87
+    private $_height;
88
+
89
+    /**
90
+     * Last fill colour used
91
+     *
92
+     * @var array
93
+     */
94
+    private $_last_fill_color;
95
+
96
+    /**
97
+     * Last stroke colour used
98
+     *
99
+     * @var array
100
+     */
101
+    private $_last_stroke_color;
102
+
103
+    /**
104
+     * Last line width used
105
+     *
106
+     * @var float
107
+     */
108
+    private $_last_line_width;
110 109
   
111
-  /**
112
-   * Total number of pages
113
-   *
114
-   * @var int
115
-   */
116
-  private $_page_count;
117
-
118
-  /**
119
-   * Text to display on every page
120
-   *
121
-   * @var array
122
-   */
123
-  private $_page_text;
124
-
125
-  /**
126
-   * Array of pages for accessing after initial rendering is complete
127
-   *
128
-   * @var array
129
-   */
130
-  private $_pages;
131
-
132
-  /**
133
-   * Class constructor
134
-   *
135
-   * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
136
-   *                     an array(xmin,ymin,xmax,ymax)
137
-   * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
138
-   */
139
-  function __construct($paper = "letter", $orientation = "portrait") {
110
+    /**
111
+     * Total number of pages
112
+     *
113
+     * @var int
114
+     */
115
+    private $_page_count;
116
+
117
+    /**
118
+     * Text to display on every page
119
+     *
120
+     * @var array
121
+     */
122
+    private $_page_text;
123
+
124
+    /**
125
+     * Array of pages for accessing after initial rendering is complete
126
+     *
127
+     * @var array
128
+     */
129
+    private $_pages;
130
+
131
+    /**
132
+     * Class constructor
133
+     *
134
+     * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
135
+     *                     an array(xmin,ymin,xmax,ymax)
136
+     * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
137
+     */
138
+    function __construct($paper = "letter", $orientation = "portrait") {
140 139
    
141 140
     if ( is_array($paper) )
142
-      $size = $paper;
141
+        $size = $paper;
143 142
     else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) )
144
-      $size = self::$PAPER_SIZE[$paper];
143
+        $size = self::$PAPER_SIZE[$paper];
145 144
     else
146
-      $size = self::$PAPER_SIZE["letter"];
145
+        $size = self::$PAPER_SIZE["letter"];
147 146
 
148 147
     if ( mb_strtolower($orientation) === "landscape" ) {
149
-      $a = $size[3];
150
-      $size[3] = $size[2];
151
-      $size[2] = $a;
148
+        $a = $size[3];
149
+        $size[3] = $size[2];
150
+        $size[2] = $a;
152 151
     }
153 152
 
154 153
     $this->_width = $size[2] - $size[0];
@@ -163,135 +162,135 @@  discard block
 block discarded – undo
163 162
     $this->_page_text = array();
164 163
 
165 164
     $this->_last_fill_color     =
166
-      $this->_last_stroke_color =
167
-      $this->_last_line_width   = null;
165
+        $this->_last_stroke_color =
166
+        $this->_last_line_width   = null;
168 167
 
169
-  }  
168
+    }  
170 169
   
171
-  /**
172
-   * Remaps y coords from 4th to 1st quadrant
173
-   *
174
-   * @param float $y
175
-   * @return float
176
-   */
177
-  protected function y($y) { return $this->_height - $y; }
178
-
179
-  /**
180
-   * Sets the stroke colour
181
-   *
182
-   * @param array $color
183
-   */
184
-  protected function _set_stroke_colour($colour) {
170
+    /**
171
+     * Remaps y coords from 4th to 1st quadrant
172
+     *
173
+     * @param float $y
174
+     * @return float
175
+     */
176
+    protected function y($y) { return $this->_height - $y; }
177
+
178
+    /**
179
+     * Sets the stroke colour
180
+     *
181
+     * @param array $color
182
+     */
183
+    protected function _set_stroke_colour($colour) {
185 184
     $colour[0] = round(255 * $colour[0]);
186 185
     $colour[1] = round(255 * $colour[1]);
187 186
     $colour[2] = round(255 * $colour[2]);
188 187
 
189 188
     if ( is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color ) {
190
-      $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
191
-      $this->_last_stroke_color = $color;
189
+        $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
190
+        $this->_last_stroke_color = $color;
192 191
     }
193 192
 
194
-  }
193
+    }
195 194
 
196
-  /**
197
-   * Sets the fill colour
198
-   *
199
-   * @param array $color
200
-   */
201
-  protected function _set_fill_colour($colour) {
195
+    /**
196
+     * Sets the fill colour
197
+     *
198
+     * @param array $color
199
+     */
200
+    protected function _set_fill_colour($colour) {
202 201
     $colour[0] = round(255 * $colour[0]);
203 202
     $colour[1] = round(255 * $colour[1]);
204 203
     $colour[2] = round(255 * $colour[2]);
205 204
 
206 205
     if ( is_null($this->_last_fill_color) || $color != $this->_last_fill_color ) {
207
-      $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
208
-      $this->_last_fill_color = $color;
206
+        $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
207
+        $this->_last_fill_color = $color;
209 208
     }
210 209
 
211
-  }
210
+    }
212 211
 
213
-  /**
214
-   * Return the TCPDF instance
215
-   *
216
-   * @return TCPDF
217
-   */
218
-  function get_tcpdf() { return $this->_pdf; }
212
+    /**
213
+     * Return the TCPDF instance
214
+     *
215
+     * @return TCPDF
216
+     */
217
+    function get_tcpdf() { return $this->_pdf; }
219 218
   
220
-  /**
221
-   * Returns the current page number
222
-   *
223
-   * @return int
224
-   */
225
-  function get_page_number() {
219
+    /**
220
+     * Returns the current page number
221
+     *
222
+     * @return int
223
+     */
224
+    function get_page_number() {
226 225
     return $this->_page_number;
227
-  }
228
-
229
-  /**
230
-   * Returns the total number of pages
231
-   *
232
-   * @return int
233
-   */
234
-  function get_page_count() {
226
+    }
227
+
228
+    /**
229
+     * Returns the total number of pages
230
+     *
231
+     * @return int
232
+     */
233
+    function get_page_count() {
235 234
     return $this->_page_count;
236
-  }
237
-
238
-  /**
239
-   * Sets the total number of pages
240
-   *
241
-   * @param int $count
242
-   */
243
-  function set_page_count($count) {
235
+    }
236
+
237
+    /**
238
+     * Sets the total number of pages
239
+     *
240
+     * @param int $count
241
+     */
242
+    function set_page_count($count) {
244 243
     $this->_page_count = (int)$count;
245
-  }
246
-
247
-  /**
248
-   * Draws a line from x1,y1 to x2,y2
249
-   *
250
-   * See {@link Style::munge_colour()} for the format of the colour array.
251
-   * See {@link Cpdf::setLineStyle()} for a description of the format of the
252
-   * $style parameter (aka dash).
253
-   *
254
-   * @param float $x1
255
-   * @param float $y1
256
-   * @param float $x2
257
-   * @param float $y2
258
-   * @param array $color
259
-   * @param float $width
260
-   * @param array $style
261
-   */
262
-  function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
244
+    }
245
+
246
+    /**
247
+     * Draws a line from x1,y1 to x2,y2
248
+     *
249
+     * See {@link Style::munge_colour()} for the format of the colour array.
250
+     * See {@link Cpdf::setLineStyle()} for a description of the format of the
251
+     * $style parameter (aka dash).
252
+     *
253
+     * @param float $x1
254
+     * @param float $y1
255
+     * @param float $x2
256
+     * @param float $y2
257
+     * @param array $color
258
+     * @param float $width
259
+     * @param array $style
260
+     */
261
+    function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
263 262
 
264 263
     if ( is_null($this->_last_line_width) || $width != $this->_last_line_width ) {
265
-      $this->_pdf->SetLineWidth($width);
266
-      $this->_last_line_width = $width;
264
+        $this->_pdf->SetLineWidth($width);
265
+        $this->_last_line_width = $width;
267 266
     }
268 267
 
269 268
     $this->_set_stroke_colour($color);
270 269
 
271 270
     // FIXME: ugh, need to handle different styles here
272 271
     $this->_pdf->line($x1, $y1, $x2, $y2);
273
-  }
274
-
275
-  /**
276
-   * Draws a rectangle at x1,y1 with width w and height h
277
-   *
278
-   * See {@link Style::munge_colour()} for the format of the colour array.
279
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
280
-   * parameter (aka dash)
281
-   *
282
-   * @param float $x1
283
-   * @param float $y1
284
-   * @param float $w
285
-   * @param float $h
286
-   * @param array $color
287
-   * @param float $width
288
-   * @param array $style
289
-   */   
290
-  function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
272
+    }
273
+
274
+    /**
275
+     * Draws a rectangle at x1,y1 with width w and height h
276
+     *
277
+     * See {@link Style::munge_colour()} for the format of the colour array.
278
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
279
+     * parameter (aka dash)
280
+     *
281
+     * @param float $x1
282
+     * @param float $y1
283
+     * @param float $w
284
+     * @param float $h
285
+     * @param array $color
286
+     * @param float $width
287
+     * @param array $style
288
+     */   
289
+    function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
291 290
 
292 291
     if ( is_null($this->_last_line_width) || $width != $this->_last_line_width ) {
293
-      $this->_pdf->SetLineWidth($width);
294
-      $this->_last_line_width = $width;
292
+        $this->_pdf->SetLineWidth($width);
293
+        $this->_last_line_width = $width;
295 294
     }
296 295
 
297 296
     $this->_set_stroke_colour($color);
@@ -299,165 +298,165 @@  discard block
 block discarded – undo
299 298
     // FIXME: ugh, need to handle styles here
300 299
     $this->_pdf->rect($x1, $y1, $w, $h);
301 300
     
302
-  }
303
-
304
-  /**
305
-   * Draws a filled rectangle at x1,y1 with width w and height h
306
-   *
307
-   * See {@link Style::munge_colour()} for the format of the colour array.
308
-   *
309
-   * @param float $x1
310
-   * @param float $y1
311
-   * @param float $w
312
-   * @param float $h
313
-   * @param array $color
314
-   */   
315
-  function filled_rectangle($x1, $y1, $w, $h, $color) {
301
+    }
302
+
303
+    /**
304
+     * Draws a filled rectangle at x1,y1 with width w and height h
305
+     *
306
+     * See {@link Style::munge_colour()} for the format of the colour array.
307
+     *
308
+     * @param float $x1
309
+     * @param float $y1
310
+     * @param float $w
311
+     * @param float $h
312
+     * @param array $color
313
+     */   
314
+    function filled_rectangle($x1, $y1, $w, $h, $color) {
316 315
 
317 316
     $this->_set_fill_colour($color);
318 317
     
319 318
     // FIXME: ugh, need to handle styles here
320 319
     $this->_pdf->rect($x1, $y1, $w, $h, "F");
321
-  }
322
-
323
-  /**
324
-   * Draws a polygon
325
-   *
326
-   * The polygon is formed by joining all the points stored in the $points
327
-   * array.  $points has the following structure:
328
-   * <code>
329
-   * array(0 => x1,
330
-   *       1 => y1,
331
-   *       2 => x2,
332
-   *       3 => y2,
333
-   *       ...
334
-   *       );
335
-   * </code>
336
-   *
337
-   * See {@link Style::munge_colour()} for the format of the colour array.
338
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
339
-   * parameter (aka dash)   
340
-   *
341
-   * @param array $points
342
-   * @param array $color
343
-   * @param float $width
344
-   * @param array $style
345
-   * @param bool  $fill  Fills the polygon if true
346
-   */
347
-  function polygon($points, $color, $width = null, $style = null, $fill = false) {
320
+    }
321
+
322
+    /**
323
+     * Draws a polygon
324
+     *
325
+     * The polygon is formed by joining all the points stored in the $points
326
+     * array.  $points has the following structure:
327
+     * <code>
328
+     * array(0 => x1,
329
+     *       1 => y1,
330
+     *       2 => x2,
331
+     *       3 => y2,
332
+     *       ...
333
+     *       );
334
+     * </code>
335
+     *
336
+     * See {@link Style::munge_colour()} for the format of the colour array.
337
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
338
+     * parameter (aka dash)   
339
+     *
340
+     * @param array $points
341
+     * @param array $color
342
+     * @param float $width
343
+     * @param array $style
344
+     * @param bool  $fill  Fills the polygon if true
345
+     */
346
+    function polygon($points, $color, $width = null, $style = null, $fill = false) {
348 347
     // FIXME: FPDF sucks
349
-  }
350
-
351
-  /**
352
-   * Draws a circle at $x,$y with radius $r
353
-   *
354
-   * See {@link Style::munge_colour()} for the format of the colour array.
355
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
356
-   * parameter (aka dash)
357
-   *
358
-   * @param float $x
359
-   * @param float $y
360
-   * @param float $r
361
-   * @param array $color
362
-   * @param float $width
363
-   * @param array $style
364
-   * @param bool $fill Fills the circle if true   
365
-   */   
366
-  function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false){}
367
-
368
-  /**
369
-   * Add an image to the pdf.
370
-   *
371
-   * The image is placed at the specified x and y coordinates with the
372
-   * given width and height.
373
-   *
374
-   * @param string $img_url the path to the image
375
-   * @param string $img_type the type (e.g. extension) of the image
376
-   * @param float $x x position
377
-   * @param float $y y position
378
-   * @param int $w width (in pixels)
379
-   * @param int $h height (in pixels)
380
-   */
381
-  function image($img_url, $img_type, $x, $y, $w, $h){}
382
-
383
-  /**
384
-   * Writes text at the specified x and y coordinates
385
-   *
386
-   * See {@link Style::munge_colour()} for the format of the colour array.
387
-   *
388
-   * @param float $x
389
-   * @param float $y
390
-   * @param string $text the text to write
391
-   * @param string $font the font file to use
392
-   * @param float $size the font size, in points
393
-   * @param array $color
394
-   * @param float $adjust word spacing adjustment
395
-   */
396
-  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0){}
397
-
398
-  function javascript($code){}
348
+    }
349
+
350
+    /**
351
+     * Draws a circle at $x,$y with radius $r
352
+     *
353
+     * See {@link Style::munge_colour()} for the format of the colour array.
354
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
355
+     * parameter (aka dash)
356
+     *
357
+     * @param float $x
358
+     * @param float $y
359
+     * @param float $r
360
+     * @param array $color
361
+     * @param float $width
362
+     * @param array $style
363
+     * @param bool $fill Fills the circle if true   
364
+     */   
365
+    function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false){}
366
+
367
+    /**
368
+     * Add an image to the pdf.
369
+     *
370
+     * The image is placed at the specified x and y coordinates with the
371
+     * given width and height.
372
+     *
373
+     * @param string $img_url the path to the image
374
+     * @param string $img_type the type (e.g. extension) of the image
375
+     * @param float $x x position
376
+     * @param float $y y position
377
+     * @param int $w width (in pixels)
378
+     * @param int $h height (in pixels)
379
+     */
380
+    function image($img_url, $img_type, $x, $y, $w, $h){}
381
+
382
+    /**
383
+     * Writes text at the specified x and y coordinates
384
+     *
385
+     * See {@link Style::munge_colour()} for the format of the colour array.
386
+     *
387
+     * @param float $x
388
+     * @param float $y
389
+     * @param string $text the text to write
390
+     * @param string $font the font file to use
391
+     * @param float $size the font size, in points
392
+     * @param array $color
393
+     * @param float $adjust word spacing adjustment
394
+     */
395
+    function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0){}
396
+
397
+    function javascript($code){}
399 398
   
400
-  /**
401
-   * Add a named destination (similar to <a name="foo">...</a> in html)
402
-   *
403
-   * @param string $anchorname The name of the named destination
404
-   */
405
-  function add_named_dest($anchorname){}
406
-
407
-  /**
408
-   * Add a link to the pdf
409
-   *
410
-   * @param string $url The url to link to
411
-   * @param float  $x   The x position of the link
412
-   * @param float  $y   The y position of the link
413
-   * @param float  $width   The width of the link
414
-   * @param float  $height   The height of the link
415
-   */
416
-  function add_link($url, $x, $y, $width, $height){}
399
+    /**
400
+     * Add a named destination (similar to <a name="foo">...</a> in html)
401
+     *
402
+     * @param string $anchorname The name of the named destination
403
+     */
404
+    function add_named_dest($anchorname){}
405
+
406
+    /**
407
+     * Add a link to the pdf
408
+     *
409
+     * @param string $url The url to link to
410
+     * @param float  $x   The x position of the link
411
+     * @param float  $y   The y position of the link
412
+     * @param float  $width   The width of the link
413
+     * @param float  $height   The height of the link
414
+     */
415
+    function add_link($url, $x, $y, $width, $height){}
417 416
   
418
-  /**
419
-   * Calculates text size, in points
420
-   *
421
-   * @param string $text the text to be sized
422
-   * @param string $font the desired font
423
-   * @param float  $size the desired font size
424
-   * @param float  $spacing word spacing, if any
425
-   * @return float
426
-   */
427
-  function get_text_width($text, $font, $size, $spacing = 0){}
428
-
429
-  /**
430
-   * Calculates font height, in points
431
-   *
432
-   * @param string $font
433
-   * @param float $size
434
-   * @return float
435
-   */
436
-  function get_font_height($font, $size){}
417
+    /**
418
+     * Calculates text size, in points
419
+     *
420
+     * @param string $text the text to be sized
421
+     * @param string $font the desired font
422
+     * @param float  $size the desired font size
423
+     * @param float  $spacing word spacing, if any
424
+     * @return float
425
+     */
426
+    function get_text_width($text, $font, $size, $spacing = 0){}
427
+
428
+    /**
429
+     * Calculates font height, in points
430
+     *
431
+     * @param string $font
432
+     * @param float $size
433
+     * @return float
434
+     */
435
+    function get_font_height($font, $size){}
437 436
 
438 437
   
439
-  /**
440
-   * Starts a new page
441
-   *
442
-   * Subsequent drawing operations will appear on the new page.
443
-   */
444
-  function new_page(){}
445
-
446
-  /**
447
-   * Streams the PDF directly to the browser
448
-   *
449
-   * @param string $filename the name of the PDF file
450
-   * @param array  $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
451
-   */
452
-  function stream($filename, $options = null){}
453
-
454
-  /**
455
-   * Returns the PDF as a string
456
-   *
457
-   * @param array  $options associative array: 'compress' => 1 or 0
458
-   * @return string
459
-   */
460
-  function output($options = null){}
438
+    /**
439
+     * Starts a new page
440
+     *
441
+     * Subsequent drawing operations will appear on the new page.
442
+     */
443
+    function new_page(){}
444
+
445
+    /**
446
+     * Streams the PDF directly to the browser
447
+     *
448
+     * @param string $filename the name of the PDF file
449
+     * @param array  $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
450
+     */
451
+    function stream($filename, $options = null){}
452
+
453
+    /**
454
+     * Returns the PDF as a string
455
+     *
456
+     * @param array  $options associative array: 'compress' => 1 or 0
457
+     * @return string
458
+     */
459
+    function output($options = null){}
461 460
   
462 461
 }
463 462
     
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/gd_adapter.cls.php 1 patch
Indentation   +378 added lines, -379 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: gd_adapter.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */
@@ -49,73 +48,73 @@  discard block
 block discarded – undo
49 48
  */
50 49
 class GD_Adapter implements Canvas {
51 50
 
52
-  /**
53
-   * Resoure handle for the image
54
-   *
55
-   * @var resource
56
-   */
57
-  private $_img;
58
-
59
-  /**
60
-   * Image width in pixels
61
-   *
62
-   * @var int
63
-   */
64
-  private $_width;
65
-
66
-  /**
67
-   * Image height in pixels
68
-   *
69
-   * @var int
70
-   */
71
-  private $_height;
72
-
73
-  /**
74
-   * Image antialias factor
75
-   *
76
-   * @var float
77
-   */
78
-  private $_aa_factor;
79
-
80
-  /**
81
-   * Allocated colors
82
-   *
83
-   * @var array
84
-   */
85
-  private $_colors;
86
-
87
-  /**
88
-   * Background color
89
-   *
90
-   * @var int
91
-   */
92
-  private $_bg_color;
51
+    /**
52
+     * Resoure handle for the image
53
+     *
54
+     * @var resource
55
+     */
56
+    private $_img;
57
+
58
+    /**
59
+     * Image width in pixels
60
+     *
61
+     * @var int
62
+     */
63
+    private $_width;
64
+
65
+    /**
66
+     * Image height in pixels
67
+     *
68
+     * @var int
69
+     */
70
+    private $_height;
71
+
72
+    /**
73
+     * Image antialias factor
74
+     *
75
+     * @var float
76
+     */
77
+    private $_aa_factor;
78
+
79
+    /**
80
+     * Allocated colors
81
+     *
82
+     * @var array
83
+     */
84
+    private $_colors;
85
+
86
+    /**
87
+     * Background color
88
+     *
89
+     * @var int
90
+     */
91
+    private $_bg_color;
93 92
   
94
-  /**
95
-   * Class constructor
96
-   *
97
-   * @param mixed  $size         The size of image to create: array(x1,y1,x2,y2) or "letter", "legal", etc.
98
-   * @param string $orientation  The orientation of the document (either 'landscape' or 'portrait')
99
-   * @param float  $aa_factor    Anti-aliasing factor, 1 for no AA
100
-   * @param array  $bg_color     Image background color: array(r,g,b,a), 0 <= r,g,b,a <= 1
101
-   */
102
-  function __construct($size, $orientation = "portrait", $aa_factor = 1, $bg_color = array(1,1,1,0) ) {
93
+    /**
94
+     * Class constructor
95
+     *
96
+     * @param mixed  $size         The size of image to create: array(x1,y1,x2,y2) or "letter", "legal", etc.
97
+     * @param string $orientation  The orientation of the document (either 'landscape' or 'portrait')
98
+     * @param float  $aa_factor    Anti-aliasing factor, 1 for no AA
99
+     * @param array  $bg_color     Image background color: array(r,g,b,a), 0 <= r,g,b,a <= 1
100
+     */
101
+    function __construct($size, $orientation = "portrait", $aa_factor = 1, $bg_color = array(1,1,1,0) ) {
103 102
 
104 103
     if ( !is_array($size) ) {
105 104
 
106
-      if ( isset(CPDF_Adapter::$PAPER_SIZES[ strtolower($size)]) ) 
105
+        if ( isset(CPDF_Adapter::$PAPER_SIZES[ strtolower($size)]) ) 
107 106
         $size = CPDF_Adapter::$PAPER_SIZES[$size];
108
-      else
107
+        else
109 108
         $size = CPDF_Adapter::$PAPER_SIZES["letter"];
110 109
     
111 110
     }
112 111
 
113 112
     if ( strtolower($orientation) === "landscape" ) {
114
-      list($size[2],$size[3]) = array($size[3],$size[2]);
113
+        list($size[2],$size[3]) = array($size[3],$size[2]);
115 114
     }
116 115
 
117 116
     if ( $aa_factor < 1 )
118
-      $aa_factor = 1;
117
+        $aa_factor = 1;
119 118
 
120 119
     $this->_aa_factor = $aa_factor;
121 120
     
@@ -128,8 +127,8 @@  discard block
 block discarded – undo
128 127
     $this->_img = imagecreatetruecolor($this->_width, $this->_height);
129 128
 
130 129
     if ( is_null($bg_color) || !is_array($bg_color) ) {
131
-      // Pure white bg
132
-      $bg_color = array(1,1,1,0);
130
+        // Pure white bg
131
+        $bg_color = array(1,1,1,0);
133 132
     }
134 133
 
135 134
     $this->_bg_color = $this->_allocate_color($bg_color);
@@ -137,68 +136,68 @@  discard block
 block discarded – undo
137 136
     imagesavealpha($this->_img, true);
138 137
     imagefill($this->_img, 0, 0, $this->_bg_color);
139 138
         
140
-  }
141
-
142
-  /**
143
-   * Return the GF image resource
144
-   *
145
-   * @return resource
146
-   */
147
-  function get_image() { return $this->_img; }
148
-
149
-  /**
150
-   * Return the image's width in pixels
151
-   *
152
-   * @return float
153
-   */
154
-  function get_width() { return $this->_width / $this->_aa_factor; }
155
-
156
-  /**
157
-   * Return the image's height in pixels
158
-   *
159
-   * @return float
160
-   */
161
-  function get_height() { return $this->_height / $this->_aa_factor; }
139
+    }
140
+
141
+    /**
142
+     * Return the GF image resource
143
+     *
144
+     * @return resource
145
+     */
146
+    function get_image() { return $this->_img; }
147
+
148
+    /**
149
+     * Return the image's width in pixels
150
+     *
151
+     * @return float
152
+     */
153
+    function get_width() { return $this->_width / $this->_aa_factor; }
154
+
155
+    /**
156
+     * Return the image's height in pixels
157
+     *
158
+     * @return float
159
+     */
160
+    function get_height() { return $this->_height / $this->_aa_factor; }
162 161
   
163
-  /**
164
-   * Returns the current page number
165
-   *
166
-   * @return int
167
-   */
168
-  function get_page_number() {
162
+    /**
163
+     * Returns the current page number
164
+     *
165
+     * @return int
166
+     */
167
+    function get_page_number() {
169 168
     // FIXME
170
-  }
169
+    }
171 170
    
172
-  /**
173
-   * Returns the total number of pages
174
-   *
175
-   * @return int
176
-   */
177
-  function get_page_count() {
171
+    /**
172
+     * Returns the total number of pages
173
+     *
174
+     * @return int
175
+     */
176
+    function get_page_count() {
178 177
     // FIXME
179
-  }    
180
-
181
-  /**
182
-   * Sets the total number of pages
183
-   *
184
-   * @param int $count
185
-   */
186
-  function set_page_count($count) {
178
+    }    
179
+
180
+    /**
181
+     * Sets the total number of pages
182
+     *
183
+     * @param int $count
184
+     */
185
+    function set_page_count($count) {
187 186
     // FIXME
188
-  }    
189
-
190
-  /**
191
-   * Allocate a new color.  Allocate with GD as needed and store
192
-   * previously allocated colors in $this->_colors.
193
-   *
194
-   * @param array $color  The new current color
195
-   * @return int           The allocated color
196
-   */
197
-  private function _allocate_color($color) {
187
+    }    
188
+
189
+    /**
190
+     * Allocate a new color.  Allocate with GD as needed and store
191
+     * previously allocated colors in $this->_colors.
192
+     *
193
+     * @param array $color  The new current color
194
+     * @return int           The allocated color
195
+     */
196
+    private function _allocate_color($color) {
198 197
     
199 198
     // Full opacity if no alpha set
200 199
     if ( !isset($color[3]) ) 
201
-      $color[3] = 0;
200
+        $color[3] = 0;
202 201
     
203 202
     list($r,$g,$b,$a) = $color;
204 203
     
@@ -221,33 +220,33 @@  discard block
 block discarded – undo
221 220
     $key = sprintf("#%02X%02X%02X%02X", $r, $g, $b, $a);
222 221
       
223 222
     if ( isset($this->_colors[$key]) )
224
-      return $this->_colors[$key];
223
+        return $this->_colors[$key];
225 224
 
226 225
     if ( $a != 0 ) 
227
-      $this->_colors[$key] = imagecolorallocatealpha($this->_img, $r, $g, $b, $a);
226
+        $this->_colors[$key] = imagecolorallocatealpha($this->_img, $r, $g, $b, $a);
228 227
     else
229
-      $this->_colors[$key] = imagecolorallocate($this->_img, $r, $g, $b);
228
+        $this->_colors[$key] = imagecolorallocate($this->_img, $r, $g, $b);
230 229
       
231 230
     return $this->_colors[$key];
232 231
     
233
-  }
232
+    }
234 233
   
235
-  /**
236
-   * Draws a line from x1,y1 to x2,y2
237
-   *
238
-   * See {@link Style::munge_color()} for the format of the color array.
239
-   * See {@link Cpdf::setLineStyle()} for a description of the format of the
240
-   * $style parameter (aka dash).
241
-   *
242
-   * @param float $x1
243
-   * @param float $y1
244
-   * @param float $x2
245
-   * @param float $y2
246
-   * @param array $color
247
-   * @param float $width
248
-   * @param array $style
249
-   */
250
-  function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
234
+    /**
235
+     * Draws a line from x1,y1 to x2,y2
236
+     *
237
+     * See {@link Style::munge_color()} for the format of the color array.
238
+     * See {@link Cpdf::setLineStyle()} for a description of the format of the
239
+     * $style parameter (aka dash).
240
+     *
241
+     * @param float $x1
242
+     * @param float $y1
243
+     * @param float $x2
244
+     * @param float $y2
245
+     * @param array $color
246
+     * @param float $width
247
+     * @param array $style
248
+     */
249
+    function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
251 250
 
252 251
     // Scale by the AA factor
253 252
     $x1 *= $this->_aa_factor;
@@ -260,63 +259,63 @@  discard block
 block discarded – undo
260 259
 
261 260
     // Convert the style array if required
262 261
     if ( !is_null($style) ) {
263
-      $gd_style = array();
262
+        $gd_style = array();
264 263
 
265
-      if ( count($style) == 1 ) {
264
+        if ( count($style) == 1 ) {
266 265
         for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) {
267
-          $gd_style[] = $c;
266
+            $gd_style[] = $c;
268 267
         }
269 268
 
270 269
         for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) {
271
-          $gd_style[] = $this->_bg_color;
270
+            $gd_style[] = $this->_bg_color;
272 271
         }
273 272
 
274
-      } else {
273
+        } else {
275 274
 
276 275
         $i = 0;
277 276
         foreach ($style as $length) {
278 277
 
279
-          if ( $i % 2 == 0 ) {
278
+            if ( $i % 2 == 0 ) {
280 279
             // 'On' pattern
281 280
             for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) 
282
-              $gd_style[] = $c;
281
+                $gd_style[] = $c;
283 282
             
284
-          } else {
283
+            } else {
285 284
             // Off pattern
286 285
             for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) 
287
-              $gd_style[] = $this->_bg_color;
286
+                $gd_style[] = $this->_bg_color;
288 287
             
289
-          }
290
-          $i++;
288
+            }
289
+            $i++;
290
+        }
291 291
         }
292
-      }
293 292
       
294
-      imagesetstyle($this->_img, $gd_style);
295
-      $c = IMG_COLOR_STYLED;
293
+        imagesetstyle($this->_img, $gd_style);
294
+        $c = IMG_COLOR_STYLED;
296 295
     }
297 296
     
298 297
     imagesetthickness($this->_img, $width);
299 298
 
300 299
     imageline($this->_img, $x1, $y1, $x2, $y2, $c);
301 300
     
302
-  }
303
-
304
-  /**
305
-   * Draws a rectangle at x1,y1 with width w and height h
306
-   *
307
-   * See {@link Style::munge_color()} for the format of the color array.
308
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
309
-   * parameter (aka dash)
310
-   *
311
-   * @param float $x1
312
-   * @param float $y1
313
-   * @param float $w
314
-   * @param float $h
315
-   * @param array $color
316
-   * @param float $width
317
-   * @param array $style
318
-   */   
319
-  function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
301
+    }
302
+
303
+    /**
304
+     * Draws a rectangle at x1,y1 with width w and height h
305
+     *
306
+     * See {@link Style::munge_color()} for the format of the color array.
307
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
308
+     * parameter (aka dash)
309
+     *
310
+     * @param float $x1
311
+     * @param float $y1
312
+     * @param float $w
313
+     * @param float $h
314
+     * @param array $color
315
+     * @param float $width
316
+     * @param array $style
317
+     */   
318
+    function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
320 319
 
321 320
     // Scale by the AA factor
322 321
     $x1 *= $this->_aa_factor;
@@ -328,36 +327,36 @@  discard block
 block discarded – undo
328 327
 
329 328
     // Convert the style array if required
330 329
     if ( !is_null($style) ) {
331
-      $gd_style = array();
330
+        $gd_style = array();
332 331
 
333
-      foreach ($style as $length) {
332
+        foreach ($style as $length) {
334 333
         for ($i = 0; $i < $length; $i++) {
335
-          $gd_style[] = $c;
334
+            $gd_style[] = $c;
335
+        }
336 336
         }
337
-      }
338 337
 
339
-      imagesetstyle($this->_img, $gd_style);
340
-      $c = IMG_COLOR_STYLED;
338
+        imagesetstyle($this->_img, $gd_style);
339
+        $c = IMG_COLOR_STYLED;
341 340
     }
342 341
 
343 342
     imagesetthickness($this->_img, $width);
344 343
 
345 344
     imagerectangle($this->_img, $x1, $y1, $x1 + $w, $y1 + $h, $c);
346 345
     
347
-  }
348
-
349
-  /**
350
-   * Draws a filled rectangle at x1,y1 with width w and height h
351
-   *
352
-   * See {@link Style::munge_color()} for the format of the color array.
353
-   *
354
-   * @param float $x1
355
-   * @param float $y1
356
-   * @param float $w
357
-   * @param float $h
358
-   * @param array $color
359
-   */   
360
-  function filled_rectangle($x1, $y1, $w, $h, $color) {
346
+    }
347
+
348
+    /**
349
+     * Draws a filled rectangle at x1,y1 with width w and height h
350
+     *
351
+     * See {@link Style::munge_color()} for the format of the color array.
352
+     *
353
+     * @param float $x1
354
+     * @param float $y1
355
+     * @param float $w
356
+     * @param float $h
357
+     * @param array $color
358
+     */   
359
+    function filled_rectangle($x1, $y1, $w, $h, $color) {
361 360
 
362 361
     // Scale by the AA factor
363 362
     $x1 *= $this->_aa_factor;
@@ -369,79 +368,79 @@  discard block
 block discarded – undo
369 368
 
370 369
     imagefilledrectangle($this->_img, $x1, $y1, $x1 + $w, $y1 + $h, $c);
371 370
 
372
-  }
373
-
374
-  /**
375
-   * Draws a polygon
376
-   *
377
-   * The polygon is formed by joining all the points stored in the $points
378
-   * array.  $points has the following structure:
379
-   * <code>
380
-   * array(0 => x1,
381
-   *       1 => y1,
382
-   *       2 => x2,
383
-   *       3 => y2,
384
-   *       ...
385
-   *       );
386
-   * </code>
387
-   *
388
-   * See {@link Style::munge_color()} for the format of the color array.
389
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
390
-   * parameter (aka dash)   
391
-   *
392
-   * @param array $points
393
-   * @param array $color
394
-   * @param float $width
395
-   * @param array $style
396
-   * @param bool  $fill  Fills the polygon if true
397
-   */
398
-  function polygon($points, $color, $width = null, $style = null, $fill = false) {
371
+    }
372
+
373
+    /**
374
+     * Draws a polygon
375
+     *
376
+     * The polygon is formed by joining all the points stored in the $points
377
+     * array.  $points has the following structure:
378
+     * <code>
379
+     * array(0 => x1,
380
+     *       1 => y1,
381
+     *       2 => x2,
382
+     *       3 => y2,
383
+     *       ...
384
+     *       );
385
+     * </code>
386
+     *
387
+     * See {@link Style::munge_color()} for the format of the color array.
388
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
389
+     * parameter (aka dash)   
390
+     *
391
+     * @param array $points
392
+     * @param array $color
393
+     * @param float $width
394
+     * @param array $style
395
+     * @param bool  $fill  Fills the polygon if true
396
+     */
397
+    function polygon($points, $color, $width = null, $style = null, $fill = false) {
399 398
 
400 399
     // Scale each point by the AA factor
401 400
     foreach (array_keys($points) as $i)
402
-      $points[$i] *= $this->_aa_factor;
401
+        $points[$i] *= $this->_aa_factor;
403 402
 
404 403
     $c = $this->_allocate_color($color);
405 404
 
406 405
     // Convert the style array if required
407 406
     if ( !is_null($style) && !$fill ) {
408
-      $gd_style = array();
407
+        $gd_style = array();
409 408
 
410
-      foreach ($style as $length) {
409
+        foreach ($style as $length) {
411 410
         for ($i = 0; $i < $length; $i++) {
412
-          $gd_style[] = $c;
411
+            $gd_style[] = $c;
412
+        }
413 413
         }
414
-      }
415 414
 
416
-      imagesetstyle($this->_img, $gd_style);
417
-      $c = IMG_COLOR_STYLED;
415
+        imagesetstyle($this->_img, $gd_style);
416
+        $c = IMG_COLOR_STYLED;
418 417
     }
419 418
 
420 419
     imagesetthickness($this->_img, $width);
421 420
 
422 421
     if ( $fill ) 
423
-      imagefilledpolygon($this->_img, $points, count($points) / 2, $c);
422
+        imagefilledpolygon($this->_img, $points, count($points) / 2, $c);
424 423
     else
425
-      imagepolygon($this->_img, $points, count($points) / 2, $c);
424
+        imagepolygon($this->_img, $points, count($points) / 2, $c);
426 425
         
427
-  }
428
-
429
-  /**
430
-   * Draws a circle at $x,$y with radius $r
431
-   *
432
-   * See {@link Style::munge_color()} for the format of the color array.
433
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
434
-   * parameter (aka dash)
435
-   *
436
-   * @param float $x
437
-   * @param float $y
438
-   * @param float $r
439
-   * @param array $color
440
-   * @param float $width
441
-   * @param array $style
442
-   * @param bool $fill Fills the circle if true   
443
-   */   
444
-  function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false) {
426
+    }
427
+
428
+    /**
429
+     * Draws a circle at $x,$y with radius $r
430
+     *
431
+     * See {@link Style::munge_color()} for the format of the color array.
432
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
433
+     * parameter (aka dash)
434
+     *
435
+     * @param float $x
436
+     * @param float $y
437
+     * @param float $r
438
+     * @param array $color
439
+     * @param float $width
440
+     * @param array $style
441
+     * @param bool $fill Fills the circle if true   
442
+     */   
443
+    function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false) {
445 444
 
446 445
     // Scale by the AA factor
447 446
     $x *= $this->_aa_factor;
@@ -452,55 +451,55 @@  discard block
 block discarded – undo
452 451
 
453 452
     // Convert the style array if required
454 453
     if ( !is_null($style) && !$fill ) {
455
-      $gd_style = array();
454
+        $gd_style = array();
456 455
 
457
-      foreach ($style as $length) {
456
+        foreach ($style as $length) {
458 457
         for ($i = 0; $i < $length; $i++) {
459
-          $gd_style[] = $c;
458
+            $gd_style[] = $c;
459
+        }
460 460
         }
461
-      }
462 461
 
463
-      imagesetstyle($this->_img, $gd_style);
464
-      $c = IMG_COLOR_STYLED;
462
+        imagesetstyle($this->_img, $gd_style);
463
+        $c = IMG_COLOR_STYLED;
465 464
     }
466 465
 
467 466
     imagesetthickness($this->_img, $width);
468 467
 
469 468
     if ( $fill )
470
-      imagefilledellipse($this->_img, $x, $y, $r, $r, $c);
469
+        imagefilledellipse($this->_img, $x, $y, $r, $r, $c);
471 470
     else
472
-      imageellipse($this->_img, $x, $y, $r, $r, $c);
471
+        imageellipse($this->_img, $x, $y, $r, $r, $c);
473 472
         
474
-  }
475
-
476
-  /**
477
-   * Add an image to the pdf.
478
-   *
479
-   * The image is placed at the specified x and y coordinates with the
480
-   * given width and height.
481
-   *
482
-   * @param string $img_url the path to the image
483
-   * @param string $img_type the type (e.g. extension) of the image
484
-   * @param float $x x position
485
-   * @param float $y y position
486
-   * @param int $w width (in pixels)
487
-   * @param int $h height (in pixels)
488
-   */
489
-  function image($img_url, $img_type, $x, $y, $w, $h) {
473
+    }
474
+
475
+    /**
476
+     * Add an image to the pdf.
477
+     *
478
+     * The image is placed at the specified x and y coordinates with the
479
+     * given width and height.
480
+     *
481
+     * @param string $img_url the path to the image
482
+     * @param string $img_type the type (e.g. extension) of the image
483
+     * @param float $x x position
484
+     * @param float $y y position
485
+     * @param int $w width (in pixels)
486
+     * @param int $h height (in pixels)
487
+     */
488
+    function image($img_url, $img_type, $x, $y, $w, $h) {
490 489
 
491 490
     switch ($img_type) {
492 491
     case "png":
493 492
       $src = @imagecreatefrompng($img_url);
494
-      break;
493
+        break;
495 494
       
496 495
     case "gif":
497 496
       $src = @imagecreatefromgif($img_url);
498
-      break;
497
+        break;
499 498
       
500 499
     case "jpg":
501 500
     case "jpeg":
502 501
       $src = @imagecreatefromjpeg($img_url);
503
-      break;
502
+        break;
504 503
 
505 504
     default:
506 505
       break;
@@ -508,7 +507,7 @@  discard block
 block discarded – undo
508 507
     }
509 508
 
510 509
     if ( !$src )
511
-      return; // Probably should add to $_dompdf_errors or whatever here
510
+        return; // Probably should add to $_dompdf_errors or whatever here
512 511
     
513 512
     // Scale by the AA factor
514 513
     $x *= $this->_aa_factor;
@@ -523,23 +522,23 @@  discard block
 block discarded – undo
523 522
     
524 523
     imagecopyresampled($this->_img, $src, $x, $y, 0, 0, $w, $h, $img_w, $img_h);
525 524
     
526
-  }
527
-
528
-  /**
529
-   * Writes text at the specified x and y coordinates
530
-   *
531
-   * See {@link Style::munge_color()} for the format of the color array.
532
-   *
533
-   * @param float $x
534
-   * @param float $y
535
-   * @param string $text the text to write
536
-   * @param string $font the font file to use
537
-   * @param float $size the font size, in points
538
-   * @param array $color
539
-   * @param float $adjust word spacing adjustment
540
-   * @param float $angle Text angle
541
-   */
542
-  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
525
+    }
526
+
527
+    /**
528
+     * Writes text at the specified x and y coordinates
529
+     *
530
+     * See {@link Style::munge_color()} for the format of the color array.
531
+     *
532
+     * @param float $x
533
+     * @param float $y
534
+     * @param string $text the text to write
535
+     * @param string $font the font file to use
536
+     * @param float $size the font size, in points
537
+     * @param array $color
538
+     * @param float $adjust word spacing adjustment
539
+     * @param float $angle Text angle
540
+     */
541
+    function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
543 542
 
544 543
     // Scale by the AA factor
545 544
     $x *= $this->_aa_factor;
@@ -551,106 +550,106 @@  discard block
 block discarded – undo
551 550
     $c = $this->_allocate_color($color);
552 551
 
553 552
     if ( strpos($font, '.ttf') === false )
554
-      $font .= ".ttf";
553
+        $font .= ".ttf";
555 554
 
556 555
     // FIXME: word spacing
557 556
     imagettftext($this->_img, $size, $angle, $x, $y + $h, $c, $font, $text);
558 557
     
559
-  }
558
+    }
560 559
   
561
-  function javascript($code) {
560
+    function javascript($code) {
562 561
     // Not implemented
563
-  }
564
-
565
-  /**
566
-   * Add a named destination (similar to <a name="foo">...</a> in html)
567
-   *
568
-   * @param string $anchorname The name of the named destination
569
-   */
570
-  function add_named_dest($anchorname) {
562
+    }
563
+
564
+    /**
565
+     * Add a named destination (similar to <a name="foo">...</a> in html)
566
+     *
567
+     * @param string $anchorname The name of the named destination
568
+     */
569
+    function add_named_dest($anchorname) {
571 570
     // Not implemented
572
-  }
573
-
574
-  /**
575
-   * Add a link to the pdf
576
-   *
577
-   * @param string $url The url to link to
578
-   * @param float  $x   The x position of the link
579
-   * @param float  $y   The y position of the link
580
-   * @param float  $width   The width of the link
581
-   * @param float  $height   The height of the link
582
-   */
583
-  function add_link($url, $x, $y, $width, $height) {
571
+    }
572
+
573
+    /**
574
+     * Add a link to the pdf
575
+     *
576
+     * @param string $url The url to link to
577
+     * @param float  $x   The x position of the link
578
+     * @param float  $y   The y position of the link
579
+     * @param float  $width   The width of the link
580
+     * @param float  $height   The height of the link
581
+     */
582
+    function add_link($url, $x, $y, $width, $height) {
584 583
     // Not implemented
585
-  }
586
-
587
-  /**
588
-   * Calculates text size, in points
589
-   *
590
-   * @param string $text the text to be sized
591
-   * @param string $font the desired font
592
-   * @param float  $size the desired font size
593
-   * @param float  $spacing word spacing, if any
594
-   * @return float
595
-   */
596
-  function get_text_width($text, $font, $size, $spacing = 0) {    
584
+    }
585
+
586
+    /**
587
+     * Calculates text size, in points
588
+     *
589
+     * @param string $text the text to be sized
590
+     * @param string $font the desired font
591
+     * @param float  $size the desired font size
592
+     * @param float  $spacing word spacing, if any
593
+     * @return float
594
+     */
595
+    function get_text_width($text, $font, $size, $spacing = 0) {    
597 596
 
598 597
     if ( strpos($font, '.ttf') === false )
599
-      $font .= ".ttf";
598
+        $font .= ".ttf";
600 599
 
601 600
     // FIXME: word spacing
602 601
     list($x1,,$x2) = imagettfbbox($size, 0, $font, $text);
603 602
     return $x2 - $x1;
604
-  }
605
-
606
-  /**
607
-   * Calculates font height, in points
608
-   *
609
-   * @param string $font
610
-   * @param float $size
611
-   * @return float
612
-   */
613
-  function get_font_height($font, $size) {
603
+    }
604
+
605
+    /**
606
+     * Calculates font height, in points
607
+     *
608
+     * @param string $font
609
+     * @param float $size
610
+     * @return float
611
+     */
612
+    function get_font_height($font, $size) {
614 613
     if ( strpos($font, '.ttf') === false )
615
-      $font .= ".ttf";
614
+        $font .= ".ttf";
616 615
 
617 616
     // FIXME: word spacing
618 617
     list(,$y2,,,,$y1) = imagettfbbox($size, 0, $font, "MXjpqytfhl");  // Test string with ascenders, descenders and caps
619 618
     return $y2 - $y1;
620
-  }
619
+    }
621 620
 
622 621
   
623
-  /**
624
-   * Starts a new page
625
-   *
626
-   * Subsequent drawing operations will appear on the new page.
627
-   */
628
-  function new_page() {
622
+    /**
623
+     * Starts a new page
624
+     *
625
+     * Subsequent drawing operations will appear on the new page.
626
+     */
627
+    function new_page() {
629 628
     // FIXME
630
-  }    
629
+    }    
631 630
 
632
-  /**
633
-   * Streams the image directly to the browser
634
-   *
635
-   * @param string $filename the name of the image file (ignored)
636
-   * @param array  $options associative array, 'type' => jpeg|jpg|png, 'quality' => 0 - 100 (jpeg only)
637
-   */
638
-  function stream($filename, $options = null) {
631
+    /**
632
+     * Streams the image directly to the browser
633
+     *
634
+     * @param string $filename the name of the image file (ignored)
635
+     * @param array  $options associative array, 'type' => jpeg|jpg|png, 'quality' => 0 - 100 (jpeg only)
636
+     */
637
+    function stream($filename, $options = null) {
639 638
 
640 639
     // Perform any antialiasing
641 640
     if ( $this->_aa_factor != 1 ) {
642
-      $dst_w = $this->_width / $this->_aa_factor;
643
-      $dst_h = $this->_height / $this->_aa_factor;
644
-      $dst = imagecreatetruecolor($dst_w, $dst_h);
645
-      imagecopyresampled($dst, $this->_img, 0, 0, 0, 0,
646
-                         $dst_w, $dst_h,
647
-                         $this->_width, $this->_height);
641
+        $dst_w = $this->_width / $this->_aa_factor;
642
+        $dst_h = $this->_height / $this->_aa_factor;
643
+        $dst = imagecreatetruecolor($dst_w, $dst_h);
644
+        imagecopyresampled($dst, $this->_img, 0, 0, 0, 0,
645
+                            $dst_w, $dst_h,
646
+                            $this->_width, $this->_height);
648 647
     } else {
649
-      $dst = $this->_img;
648
+        $dst = $this->_img;
650 649
     }
651 650
 
652 651
     if ( !isset($options["type"]) )
653
-      $options["type"] = "png";
652
+        $options["type"] = "png";
654 653
 
655 654
     $type = strtolower($options["type"]);
656 655
     
@@ -663,42 +662,42 @@  discard block
 block discarded – undo
663 662
       if ( !isset($options["quality"]) )
664 663
         $options["quality"] = 75;
665 664
       
666
-      header("Content-type: image/jpeg");
667
-      imagejpeg($dst, '', $options["quality"]);
668
-      break;
665
+        header("Content-type: image/jpeg");
666
+        imagejpeg($dst, '', $options["quality"]);
667
+        break;
669 668
 
670 669
     case "png":
671 670
     default:
672 671
       header("Content-type: image/png");
673
-      imagepng($dst);
674
-      break;
672
+        imagepng($dst);
673
+        break;
675 674
     }
676 675
 
677 676
     if ( $this->_aa_factor != 1 ) 
678
-      imagedestroy($dst);
679
-  }
677
+        imagedestroy($dst);
678
+    }
680 679
 
681
-  /**
682
-   * Returns the PNG as a string
683
-   *
684
-   * @param array  $options associative array, 'type' => jpeg|jpg|png, 'quality' => 0 - 100 (jpeg only)
685
-   * @return string
686
-   */
687
-  function output($options = null) {
680
+    /**
681
+     * Returns the PNG as a string
682
+     *
683
+     * @param array  $options associative array, 'type' => jpeg|jpg|png, 'quality' => 0 - 100 (jpeg only)
684
+     * @return string
685
+     */
686
+    function output($options = null) {
688 687
 
689 688
     if ( $this->_aa_factor != 1 ) {
690
-      $dst_w = $this->_width / $this->_aa_factor;
691
-      $dst_h = $this->_height / $this->_aa_factor;
692
-      $dst = imagecreatetruecolor($dst_w, $dst_h);
693
-      imagecopyresampled($dst, $this->_img, 0, 0, 0, 0,
694
-                         $dst_w, $dst_h,
695
-                         $this->_width, $this->_height);
689
+        $dst_w = $this->_width / $this->_aa_factor;
690
+        $dst_h = $this->_height / $this->_aa_factor;
691
+        $dst = imagecreatetruecolor($dst_w, $dst_h);
692
+        imagecopyresampled($dst, $this->_img, 0, 0, 0, 0,
693
+                            $dst_w, $dst_h,
694
+                            $this->_width, $this->_height);
696 695
     } else {
697
-      $dst = $this->_img;
696
+        $dst = $this->_img;
698 697
     }
699 698
     
700 699
     if ( !isset($options["type"]) )
701
-      $options["type"] = "png";
700
+        $options["type"] = "png";
702 701
 
703 702
     $type = $options["type"];
704 703
     
@@ -711,23 +710,23 @@  discard block
 block discarded – undo
711 710
       if ( !isset($options["quality"]) )
712 711
         $options["quality"] = 75;
713 712
       
714
-      imagejpeg($dst, '', $options["quality"]);
715
-      break;
713
+        imagejpeg($dst, '', $options["quality"]);
714
+        break;
716 715
 
717 716
     case "png":
718 717
     default:
719 718
       imagepng($dst);
720
-      break;
719
+        break;
721 720
     }
722 721
 
723 722
     $image = ob_get_contents();
724 723
     ob_end_clean();
725 724
 
726 725
     if ( $this->_aa_factor != 1 )
727
-      imagedestroy($dst);
726
+        imagedestroy($dst);
728 727
     
729 728
     return $image;
730
-  }
729
+    }
731 730
   
732 731
   
733 732
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/text_frame_decorator.cls.php 1 patch
Indentation   +49 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: text_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,34 +46,34 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Text_Frame_Decorator extends Frame_Decorator {
49 48
   
50
-  // protected members
51
-  protected $_text_spacing;
49
+    // protected members
50
+    protected $_text_spacing;
52 51
   
53
-  function __construct(Frame $frame, DOMPDF $dompdf) {
52
+    function __construct(Frame $frame, DOMPDF $dompdf) {
54 53
     if ( $frame->get_node()->nodeName !== "#text" )
55
-      throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes.");
54
+        throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes.");
56 55
     
57 56
     parent::__construct($frame, $dompdf);
58 57
     $this->_text_spacing = null;
59
-  }
58
+    }
60 59
 
61
-  //........................................................................
60
+    //........................................................................
62 61
 
63
-  function reset() {
62
+    function reset() {
64 63
     parent::reset();
65 64
     $this->_text_spacing = null;
66
-  }
65
+    }
67 66
   
68
-  //........................................................................
67
+    //........................................................................
69 68
 
70
-  // Accessor methods
71
-  function get_text_spacing() { return $this->_text_spacing; }
69
+    // Accessor methods
70
+    function get_text_spacing() { return $this->_text_spacing; }
72 71
       
73
-  function get_text() {
72
+    function get_text() {
74 73
     // FIXME: this should be in a child class (and is incorrect)
75 74
     if ( $this->_frame->get_style()->content !== "normal" ) {
76
-      $this->_frame->get_node()->data = $this->_frame->get_style()->content;
77
-      $this->_frame->get_style()->content = "normal";
75
+        $this->_frame->get_node()->data = $this->_frame->get_style()->content;
76
+        $this->_frame->get_style()->content = "normal";
78 77
     }
79 78
 
80 79
 //      pre_r("---");
@@ -86,19 +85,19 @@  discard block
 block discarded – undo
86 85
 //      pre_r("width: " . Font_Metrics::get_text_width($text, $style->font_family, $style->font_size));
87 86
 
88 87
     return $this->_frame->get_node()->data;
89
-  }
88
+    }
90 89
 
91
-  //........................................................................
90
+    //........................................................................
92 91
 
93
-  // Vertical margins & padding do not apply to text frames
92
+    // Vertical margins & padding do not apply to text frames
94 93
 
95
-  // http://www.w3.org/TR/CSS21/visudet.html#inline-non-replaced:
96
-  //
97
-  // The vertical padding, border and margin of an inline, non-replaced box
98
-  // start at the top and bottom of the content area, not the
99
-  // 'line-height'. But only the 'line-height' is used to calculate the
100
-  // height of the line box.
101
-  function get_margin_height() {
94
+    // http://www.w3.org/TR/CSS21/visudet.html#inline-non-replaced:
95
+    //
96
+    // The vertical padding, border and margin of an inline, non-replaced box
97
+    // start at the top and bottom of the content area, not the
98
+    // 'line-height'. But only the 'line-height' is used to calculate the
99
+    // height of the line box.
100
+    function get_margin_height() {
102 101
     // This function is called in add_frame_to_line() and is used to
103 102
     // determine the line height, so we actually want to return the
104 103
     // 'line-height' property, not the actual margin box
@@ -116,28 +115,28 @@  discard block
 block discarded – undo
116 115
 
117 116
     return ($style->line_height / $size) * Font_Metrics::get_font_height($font, $size);
118 117
     
119
-  }
118
+    }
120 119
 
121
-  function get_padding_box() {
120
+    function get_padding_box() {
122 121
     $pb = $this->_frame->get_padding_box();
123 122
     $pb[3] = $pb["h"] = $this->_frame->get_style()->height;
124 123
     return $pb;
125
-  }
126
-  //........................................................................
124
+    }
125
+    //........................................................................
127 126
 
128
-  // Set method
129
-  function set_text_spacing($spacing) {
127
+    // Set method
128
+    function set_text_spacing($spacing) {
130 129
     $this->_text_spacing = $spacing;
131 130
 
132 131
     $style = $this->_frame->get_style();
133 132
     // Re-adjust our width to account for the change in spacing
134 133
     $style->width = Font_Metrics::get_text_width($this->get_text(), $style->font_family, $style->font_size, $spacing);
135
-  }
134
+    }
136 135
 
137
-  //........................................................................
136
+    //........................................................................
138 137
 
139
-  // Recalculate the text width
140
-  function recalculate_width() {
138
+    // Recalculate the text width
139
+    function recalculate_width() {
141 140
     $style = $this->get_style();
142 141
     $text = $this->get_text();
143 142
     $size = $style->font_size;
@@ -145,17 +144,17 @@  discard block
 block discarded – undo
145 144
     $word_spacing = $style->length_in_pt($style->word_spacing);
146 145
 
147 146
     $style->width = Font_Metrics::get_text_width($text, $font, $size, $word_spacing);
148
-  }
147
+    }
149 148
   
150
-  //........................................................................
149
+    //........................................................................
151 150
 
152
-  // Text manipulation methods
151
+    // Text manipulation methods
153 152
   
154
-  // split the text in this frame at the offset specified.  The remaining
155
-  // text is added a sibling frame following this one and is returned.
156
-  function split_text($offset) {
153
+    // split the text in this frame at the offset specified.  The remaining
154
+    // text is added a sibling frame following this one and is returned.
155
+    function split_text($offset) {
157 156
     if ( $offset == 0 )
158
-      return;
157
+        return;
159 158
 
160 159
     $split = $this->_frame->get_node()->splitText($offset);
161 160
     $deco = $this->copy($split);
@@ -164,20 +163,20 @@  discard block
 block discarded – undo
164 163
     $p->insert_child_after($deco, $this, false);
165 164
 
166 165
     if ( $p instanceof Inline_Frame_Decorator )
167
-      $p->split($deco);
166
+        $p->split($deco);
168 167
 
169
-  }
168
+    }
170 169
 
171
-  //........................................................................
170
+    //........................................................................
172 171
 
173
-  function delete_text($offset, $count) {
172
+    function delete_text($offset, $count) {
174 173
     $this->_frame->get_node()->deleteData($offset, $count);
175
-  }
174
+    }
176 175
 
177
-  //........................................................................
176
+    //........................................................................
178 177
 
179
-  function set_text($text) {
178
+    function set_text($text) {
180 179
     $this->_frame->get_node()->data = $text;
181
-  }
180
+    }
182 181
 
183 182
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/generated_frame_reflower.cls.php 1 patch
Indentation   +91 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: generated_frame_reflower.cls.php,v $
6
- * Created on: 2004-06-23
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: generated_frame_reflower.cls.php,v $
6
+     * Created on: 2004-06-23
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: generated_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -47,22 +46,22 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Generated_Frame_Reflower extends Frame_Reflower {
49 48
 
50
-  protected $_reflower; // Decoration target
49
+    protected $_reflower; // Decoration target
51 50
 
52
-  function __construct(Frame $frame) {
51
+    function __construct(Frame $frame) {
53 52
     parent::__construct($frame);
54
-  }
53
+    }
55 54
 
56
-  function set_reflower(Frame_Reflower $reflow) {
55
+    function set_reflower(Frame_Reflower $reflow) {
57 56
     $this->_reflower = $reflow;
58
-  }
57
+    }
59 58
 
60
-  //........................................................................
59
+    //........................................................................
61 60
 
62
-  protected function _parse_string($string) {
61
+    protected function _parse_string($string) {
63 62
     $string = trim($string, "'\"");
64 63
     $string = str_replace(array("\\\n",'\\"',"\\'"),
65
-                          array("",'"',"'"), $string);
64
+                            array("",'"',"'"), $string);
66 65
 
67 66
     // Convert escaped hex characters into ascii characters (e.g. \A => newline)
68 67
     $string = preg_replace_callback("/\\\\([0-9a-fA-F]{0,6})(\s)?(?(2)|(?=[^0-9a-fA-F]))/",
@@ -70,40 +69,40 @@  discard block
 block discarded – undo
70 69
                                                     'return chr(hexdec($matches[1]));'),
71 70
                                     $string);
72 71
     return $string;
73
-  }
72
+    }
74 73
 
75
-  protected function _parse_content() {
74
+    protected function _parse_content() {
76 75
     $style = $this->_frame->get_style();
77 76
 
78 77
     // Matches generated content
79 78
     $re = "/\n".
80
-      "\s(counters?\\([^)]*\\))|\n".
81
-      "\A(counters?\\([^)]*\\))|\n".
82
-      "\s([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\3|\n".
83
-      "\A([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\5|\n" .
84
-      "\s([^\s\"']+)|\n" .
85
-      "\A([^\s\"']+)\n".
86
-      "/xi";
79
+        "\s(counters?\\([^)]*\\))|\n".
80
+        "\A(counters?\\([^)]*\\))|\n".
81
+        "\s([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\3|\n".
82
+        "\A([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\5|\n" .
83
+        "\s([^\s\"']+)|\n" .
84
+        "\A([^\s\"']+)\n".
85
+        "/xi";
87 86
 
88 87
     $content = $style->content;
89 88
 
90 89
     // split on spaces, except within quotes
91 90
     if (!preg_match_all($re, $content, $matches, PREG_SET_ORDER))
92
-      return;
91
+        return;
93 92
 
94 93
     $text = "";
95 94
 
96 95
     foreach ($matches as $match) {
97
-      if ( isset($match[2]) && $match[2] !== "" )
96
+        if ( isset($match[2]) && $match[2] !== "" )
98 97
         $match[1] = $match[1];
99 98
 
100
-      if ( isset($match[6]) && $match[6] !== "" )
99
+        if ( isset($match[6]) && $match[6] !== "" )
101 100
         $match[4] = $match[6];
102 101
 
103
-      if ( isset($match[8]) && $match[8] !== "" )
102
+        if ( isset($match[8]) && $match[8] !== "" )
104 103
         $match[7] = $match[8];
105 104
 
106
-      if ( isset($match[1]) && $match[1] !== "" ) {
105
+        if ( isset($match[1]) && $match[1] !== "" ) {
107 106
         // counters?(...)
108 107
         $match[1] = mb_strtolower(trim($match[1]));
109 108
 
@@ -112,85 +111,85 @@  discard block
 block discarded – undo
112 111
 
113 112
         $i = mb_strpos($match[1], ")");
114 113
         if ( $i === false )
115
-          continue;
114
+            continue;
116 115
 
117 116
         $args = explode(",", mb_substr($match[1], 7, $i - 7));
118 117
         $counter_id = $args[0];
119 118
 
120 119
         if ( $match[1]{7} === "(" ) {
121
-          // counter(name [,style])
120
+            // counter(name [,style])
122 121
 
123
-          if ( isset($args[1]) )
122
+            if ( isset($args[1]) )
124 123
             $type = $args[1];
125
-          else
124
+            else
126 125
             $type = null;
127 126
 
128 127
 
129
-          $p = $this->_frame->find_block_parent();
128
+            $p = $this->_frame->find_block_parent();
130 129
 
131
-          $text .= $p->counter_value($counter_id, $type);
130
+            $text .= $p->counter_value($counter_id, $type);
132 131
 
133 132
         } else if ( $match[1]{7} === "s" ) {
134
-          // counters(name, string [,style])
135
-          if ( isset($args[1]) )
133
+            // counters(name, string [,style])
134
+            if ( isset($args[1]) )
136 135
             $string = $this->_parse_string(trim($args[1]));
137
-          else
136
+            else
138 137
             $string = "";
139 138
 
140
-          if ( isset($args[2]) )
139
+            if ( isset($args[2]) )
141 140
             $type = $args[2];
142
-          else
141
+            else
143 142
             $type = null;
144 143
 
145
-          $p = $this->_frame->find_block_parent();
146
-          $tmp = "";
147
-          while ($p) {
144
+            $p = $this->_frame->find_block_parent();
145
+            $tmp = "";
146
+            while ($p) {
148 147
             $tmp = $p->counter_value($counter_id, $type) . $string . $tmp;
149 148
             $p = $p->find_block_parent();
150
-          }
151
-          $text .= $tmp;
149
+            }
150
+            $text .= $tmp;
152 151
 
153 152
         } else
154
-          // countertops?
155
-          continue;
153
+            // countertops?
154
+            continue;
156 155
 
157
-      } else if ( isset($match[4]) && $match[4] !== "" ) {
156
+        } else if ( isset($match[4]) && $match[4] !== "" ) {
158 157
         // String match
159 158
         $text .= $this->_parse_string($match[4]);
160 159
 
161
-      } else if ( isset($match[7]) && $match[7] !== "" ) {
160
+        } else if ( isset($match[7]) && $match[7] !== "" ) {
162 161
         // Directive match
163 162
 
164 163
         if ( $match[7] === "open-quote" ) {
165
-          // FIXME: do something here
164
+            // FIXME: do something here
166 165
         } else if ( $match[7] === "close-quote" ) {
167
-          // FIXME: do something else here
166
+            // FIXME: do something else here
168 167
         } else if ( $match[7] === "no-open-quote" ) {
169
-          // FIXME:
168
+            // FIXME:
170 169
         } else if ( $match[7] === "no-close-quote" ) {
171
-          // FIXME:
170
+            // FIXME:
172 171
         } else if ( mb_strpos($match[7],"attr(") === 0 ) {
173 172
 
174
-          $i = mb_strpos($match[7],")");
175
-          if ( $i === false )
173
+            $i = mb_strpos($match[7],")");
174
+            if ( $i === false )
176 175
             continue;
177 176
 
178
-          $attr = mb_substr($match[7], 6, $i - 6);
179
-          if ( $attr == "" )
177
+            $attr = mb_substr($match[7], 6, $i - 6);
178
+            if ( $attr == "" )
180 179
             continue;
181 180
 
182
-          $text .= $this->_frame->get_node()->getAttribute($attr);
181
+            $text .= $this->_frame->get_node()->getAttribute($attr);
183 182
         } else
184
-          continue;
183
+            continue;
185 184
 
186
-      }
185
+        }
187 186
     }
188 187
 
189 188
     return $text;
190 189
 
191
-  }
190
+    }
192 191
 
193
-  function reflow() {
192
+    function reflow() {
194 193
     $style = $this->_frame->get_style();
195 194
 
196 195
     $text = $this->_parse_content();
@@ -202,5 +201,5 @@  discard block
 block discarded – undo
202 201
 
203 202
     $this->_frame->prepend_child(Frame_Factory::decorate_frame($t_frame));
204 203
     $this->_reflower->reflow();
205
-  }
204
+    }
206 205
 }
Please login to merge, or discard this patch.