Completed
Push — 1.10.x ( 181e18...3b3cbc )
by Angel Fernando Quiroz
104:16 queued 53:32
created
main/inc/lib/phpdocx/pdf/www/head.inc 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 function li_arrow() {
3
-  return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
3
+    return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
4 4
 }
5 5
 function li_star() {
6
-  return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
6
+    return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
7 7
 }
8 8
 ?>
9 9
 <?php echo '<?' . 'xml version="1.0" encoding="iso-8859-1"?' . '>'; ?>
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/image_frame_decorator.cls.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -52,28 +52,28 @@  discard block
 block discarded – undo
52 52
  */
53 53
 class Image_Frame_Decorator extends Frame_Decorator {
54 54
 
55
-  /**
56
-   * The path to the image file (note that remote images are
57
-   * downloaded locally to DOMPDF_TEMP_DIR).
58
-   *
59
-   * @var string
60
-   */
61
-  protected $_image_url;
55
+    /**
56
+     * The path to the image file (note that remote images are
57
+     * downloaded locally to DOMPDF_TEMP_DIR).
58
+     *
59
+     * @var string
60
+     */
61
+    protected $_image_url;
62 62
 
63
-  /**
64
-   * The image's file extension (i.e. png, jpeg, gif)
65
-   *
66
-   * @var string
67
-   */
68
-  protected $_image_ext;
63
+    /**
64
+     * The image's file extension (i.e. png, jpeg, gif)
65
+     *
66
+     * @var string
67
+     */
68
+    protected $_image_ext;
69 69
 
70
-  /**
71
-   * Class constructor
72
-   *
73
-   * @param Frame $frame the frame to decorate
74
-   * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls)
75
-   */
76
-  function __construct(Frame $frame, DOMPDF $dompdf) {
70
+    /**
71
+     * Class constructor
72
+     *
73
+     * @param Frame $frame the frame to decorate
74
+     * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls)
75
+     */
76
+    function __construct(Frame $frame, DOMPDF $dompdf) {
77 77
     global $_dompdf_warnings;
78 78
     
79 79
     parent::__construct($frame, $dompdf);
@@ -83,28 +83,28 @@  discard block
 block discarded – undo
83 83
     if (DEBUGPNG) print '[__construct '.$url.']';
84 84
 
85 85
     list($this->_image_url, $this->_image_ext) = Image_Cache::resolve_url($url,
86
-                                                                          $dompdf->get_protocol(),
87
-                                                                          $dompdf->get_host(),
88
-                                                                          $dompdf->get_base_path());
86
+                                                                            $dompdf->get_protocol(),
87
+                                                                            $dompdf->get_host(),
88
+                                                                            $dompdf->get_base_path());
89 89
     
90
-  }
90
+    }
91 91
 
92
-  /**
93
-   * Return the image's url
94
-   *
95
-   * @return string The url of this image
96
-   */
97
-  function get_image_url() {
92
+    /**
93
+     * Return the image's url
94
+     *
95
+     * @return string The url of this image
96
+     */
97
+    function get_image_url() {
98 98
     return $this->_image_url;
99
-  }
99
+    }
100 100
 
101
-  /**
102
-   * Return the image's file extension
103
-   *
104
-   * @return string The image's file extension
105
-   */
106
-  function get_image_ext() {
101
+    /**
102
+     * Return the image's file extension
103
+     *
104
+     * @return string The image's file extension
105
+     */
106
+    function get_image_ext() {
107 107
     return $this->_image_ext;
108
-  }
108
+    }
109 109
   
110 110
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame.cls.php 1 patch
Indentation   +343 added lines, -344 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: frame.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -53,105 +52,105 @@  discard block
 block discarded – undo
53 52
  */
54 53
 class Frame {
55 54
   
56
-  /**
57
-   * The DOMNode object this frame represents
58
-   *
59
-   * @var DOMNode
60
-   */
61
-  protected $_node;
62
-
63
-  /**
64
-   * Unique identifier for this frame.  Used to reference this frame
65
-   * via the node.
66
-   *
67
-   * @var string
68
-   */
69
-  protected $_id;
70
-
71
-  /**
72
-   * Unique id counter
73
-   */
74
-  static protected $ID_COUNTER = 0;
55
+    /**
56
+     * The DOMNode object this frame represents
57
+     *
58
+     * @var DOMNode
59
+     */
60
+    protected $_node;
61
+
62
+    /**
63
+     * Unique identifier for this frame.  Used to reference this frame
64
+     * via the node.
65
+     *
66
+     * @var string
67
+     */
68
+    protected $_id;
69
+
70
+    /**
71
+     * Unique id counter
72
+     */
73
+    static protected $ID_COUNTER = 0;
75 74
   
76
-  /**
77
-   * This frame's calculated style
78
-   *
79
-   * @var Style
80
-   */
81
-  protected $_style;
82
-
83
-  /**
84
-   * This frame's original style.  Needed for cases where frames are
85
-   * split across pages.
86
-   *
87
-   * @var Style
88
-   */
89
-  protected $_original_style;
75
+    /**
76
+     * This frame's calculated style
77
+     *
78
+     * @var Style
79
+     */
80
+    protected $_style;
81
+
82
+    /**
83
+     * This frame's original style.  Needed for cases where frames are
84
+     * split across pages.
85
+     *
86
+     * @var Style
87
+     */
88
+    protected $_original_style;
90 89
   
91
-  /**
92
-   * This frame's parent in the document tree.
93
-   *
94
-   * @var Frame
95
-   */
96
-  protected $_parent;
97
-
98
-  /**
99
-   * This frame's first child.  All children are handled as a
100
-   * doubly-linked list.
101
-   *
102
-   * @var Frame
103
-   */
104
-  protected $_first_child;
105
-
106
-  /**
107
-   * This frame's last child.
108
-   *
109
-   * @var Frame
110
-   */
111
-  protected $_last_child;
112
-
113
-  /**
114
-   * This frame's previous sibling in the document tree.
115
-   *
116
-   * @var Frame
117
-   */
118
-  protected $_prev_sibling;
119
-
120
-  /**
121
-   * This frame's next sibling in the document tree.
122
-   *
123
-   * @var Frame
124
-   */
125
-  protected $_next_sibling;
90
+    /**
91
+     * This frame's parent in the document tree.
92
+     *
93
+     * @var Frame
94
+     */
95
+    protected $_parent;
96
+
97
+    /**
98
+     * This frame's first child.  All children are handled as a
99
+     * doubly-linked list.
100
+     *
101
+     * @var Frame
102
+     */
103
+    protected $_first_child;
104
+
105
+    /**
106
+     * This frame's last child.
107
+     *
108
+     * @var Frame
109
+     */
110
+    protected $_last_child;
111
+
112
+    /**
113
+     * This frame's previous sibling in the document tree.
114
+     *
115
+     * @var Frame
116
+     */
117
+    protected $_prev_sibling;
118
+
119
+    /**
120
+     * This frame's next sibling in the document tree.
121
+     *
122
+     * @var Frame
123
+     */
124
+    protected $_next_sibling;
126 125
   
127
-  /**
128
-   * This frame's containing block (used in layout): array(x, y, w, h)
129
-   *
130
-   * @var array
131
-   */
132
-  protected $_containing_block;
133
-
134
-  /**
135
-   * Position on the page of the top-left corner of the margin box of
136
-   * this frame: array(x,y)
137
-   *
138
-   * @var array
139
-   */
140
-  protected $_position;
141
-
142
-  /**
143
-   * This frame's decorator
144
-   *
145
-   * @var Frame_Decorator
146
-   */
147
-  protected $_decorator;
148
-    
149
-  /**
150
-   * Class constructor
151
-   *
152
-   * @param DOMNode $node the DOMNode this frame represents
153
-   */
154
-  function __construct(DomNode $node) {
126
+    /**
127
+     * This frame's containing block (used in layout): array(x, y, w, h)
128
+     *
129
+     * @var array
130
+     */
131
+    protected $_containing_block;
132
+
133
+    /**
134
+     * Position on the page of the top-left corner of the margin box of
135
+     * this frame: array(x,y)
136
+     *
137
+     * @var array
138
+     */
139
+    protected $_position;
140
+
141
+    /**
142
+     * This frame's decorator
143
+     *
144
+     * @var Frame_Decorator
145
+     */
146
+    protected $_decorator;
147
+    
148
+    /**
149
+     * Class constructor
150
+     *
151
+     * @param DOMNode $node the DOMNode this frame represents
152
+     */
153
+    function __construct(DomNode $node) {
155 154
     $this->_node = $node;
156 155
       
157 156
     $this->_parent = null;
@@ -163,48 +162,48 @@  discard block
 block discarded – undo
163 162
     $this->_original_style = null;
164 163
     
165 164
     $this->_containing_block = array("x" => null,
166
-                                     "y" => null,
167
-                                     "w" => null,
168
-                                     "h" => null);
165
+                                        "y" => null,
166
+                                        "w" => null,
167
+                                        "h" => null);
169 168
     $this->_position = array("x" => null,
170
-                             "y" => null);
169
+                                "y" => null);
171 170
 
172 171
     $this->_decorator = null;
173 172
 
174 173
     $this->set_id( self::$ID_COUNTER++ );
175
-  }
174
+    }
176 175
 
177
-  /**
178
-   * "Destructor": forcibly free all references held by this frame
179
-   *
180
-   * @param bool $recursive if true, call dispose on all children
181
-   */
182
-  function dispose($recursive = false) {
176
+    /**
177
+     * "Destructor": forcibly free all references held by this frame
178
+     *
179
+     * @param bool $recursive if true, call dispose on all children
180
+     */
181
+    function dispose($recursive = false) {
183 182
 
184 183
     if ( $recursive ) {
185
-      while ( $child = $this->_first_child )
184
+        while ( $child = $this->_first_child )
186 185
         $child->dispose(true);
187 186
     }
188 187
 
189 188
     // Remove this frame from the tree
190 189
     if ( $this->_prev_sibling ) {
191
-      $this->_prev_sibling->_next_sibling = $this->_next_sibling;      
190
+        $this->_prev_sibling->_next_sibling = $this->_next_sibling;      
192 191
     }
193 192
 
194 193
     if ( $this->_next_sibling ) {
195
-      $this->_next_sibling->_prev_sibling = $this->_prev_sibling;
194
+        $this->_next_sibling->_prev_sibling = $this->_prev_sibling;
196 195
     }
197 196
 
198 197
     if ( $this->_parent && $this->_parent->_first_child === $this ) {
199
-      $this->_parent->_first_child = $this->_next_sibling;
198
+        $this->_parent->_first_child = $this->_next_sibling;
200 199
     }
201 200
 
202 201
     if ( $this->_parent && $this->_parent->_last_child === $this ) {
203
-      $this->_parent->_last_child = $this->_prev_sibling;
202
+        $this->_parent->_last_child = $this->_prev_sibling;
204 203
     }
205 204
 
206 205
     if ( $this->_parent ) {
207
-      $this->_parent->get_node()->removeChild($this->_node);
206
+        $this->_parent->get_node()->removeChild($this->_node);
208 207
     }
209 208
 
210 209
     $this->_style->dispose();
@@ -212,369 +211,369 @@  discard block
 block discarded – undo
212 211
     $this->_original_style->dispose();
213 212
     unset($this->_original_style);
214 213
     
215
-  }
214
+    }
216 215
 
217
-  // Re-initialize the frame
218
-  function reset() {
216
+    // Re-initialize the frame
217
+    function reset() {
219 218
     $this->_position = array("x" => null,
220
-                             "y" => null);
219
+                                "y" => null);
221 220
     $this->_containing_block = array("x" => null,
222
-                                     "y" => null,
223
-                                     "w" => null,
224
-                                     "h" => null);
221
+                                        "y" => null,
222
+                                        "w" => null,
223
+                                        "h" => null);
225 224
 
226 225
     unset($this->_style);    
227 226
     $this->_style = clone $this->_original_style;
228 227
     
229
-  }
228
+    }
230 229
   
231
-  //........................................................................
232
-
233
-  // Accessor methods
234
-  function get_node() { return $this->_node; }
235
-  function get_id() { return $this->_id; }
236
-  function get_style() { return $this->_style; }
237
-  function get_original_style() { return $this->_original_style; }
238
-  function get_parent() { return $this->_parent; }
239
-  function get_decorator() { return $this->_decorator; }
240
-  function get_first_child() { return $this->_first_child; }
241
-  function get_last_child() { return $this->_last_child; }
242
-  function get_prev_sibling() { return $this->_prev_sibling; }
243
-  function get_next_sibling() { return $this->_next_sibling; }
244
-
245
-  function get_children() { return new FrameList($this); }
230
+    //........................................................................
231
+
232
+    // Accessor methods
233
+    function get_node() { return $this->_node; }
234
+    function get_id() { return $this->_id; }
235
+    function get_style() { return $this->_style; }
236
+    function get_original_style() { return $this->_original_style; }
237
+    function get_parent() { return $this->_parent; }
238
+    function get_decorator() { return $this->_decorator; }
239
+    function get_first_child() { return $this->_first_child; }
240
+    function get_last_child() { return $this->_last_child; }
241
+    function get_prev_sibling() { return $this->_prev_sibling; }
242
+    function get_next_sibling() { return $this->_next_sibling; }
243
+
244
+    function get_children() { return new FrameList($this); }
246 245
   
247
-  // Layout property accessors
248
-  function get_containing_block($i = null) {
246
+    // Layout property accessors
247
+    function get_containing_block($i = null) {
249 248
     if ( isset($i) )
250
-      return $this->_containing_block[$i];    
249
+        return $this->_containing_block[$i];    
251 250
     return $this->_containing_block;
252
-  }
251
+    }
253 252
   
254
-  function get_position($i = null) {
253
+    function get_position($i = null) {
255 254
     if ( isset($i) )
256
-      return $this->_position[$i];
255
+        return $this->_position[$i];
257 256
     return array($this->_position["x"],
258
-                 $this->_position["y"],
259
-                 "x"=>$this->_position["x"],
260
-                 "y"=>$this->_position["y"]);
261
-  }
257
+                    $this->_position["y"],
258
+                    "x"=>$this->_position["x"],
259
+                    "y"=>$this->_position["y"]);
260
+    }
262 261
     
263
-  //........................................................................
262
+    //........................................................................
264 263
 
265
-  // Return the height of the margin box of the frame, in pt.  Meaningless
266
-  // unless the height has been calculated properly.
267
-  function get_margin_height() {      
264
+    // Return the height of the margin box of the frame, in pt.  Meaningless
265
+    // unless the height has been calculated properly.
266
+    function get_margin_height() {      
268 267
     return $this->_style->length_in_pt(array($this->_style->height,
269
-                                             $this->_style->margin_top,
270
-                                             $this->_style->margin_bottom,
271
-                                             $this->_style->border_top_width,
272
-                                             $this->_style->border_bottom_width,
273
-                                             $this->_style->padding_top,
274
-                                             $this->_style->padding_bottom),
275
-                                       $this->_containing_block["w"]);
276
-  }
277
-
278
-  // Return the width of the margin box of the frame, in pt.  Meaningless
279
-  // unless the width has been calculted properly.
280
-  function get_margin_width() {
268
+                                                $this->_style->margin_top,
269
+                                                $this->_style->margin_bottom,
270
+                                                $this->_style->border_top_width,
271
+                                                $this->_style->border_bottom_width,
272
+                                                $this->_style->padding_top,
273
+                                                $this->_style->padding_bottom),
274
+                                        $this->_containing_block["w"]);
275
+    }
276
+
277
+    // Return the width of the margin box of the frame, in pt.  Meaningless
278
+    // unless the width has been calculted properly.
279
+    function get_margin_width() {
281 280
     return $this->_style->length_in_pt(array($this->_style->width,
282
-                                     $this->_style->margin_left,
283
-                                     $this->_style->margin_right,
284
-                                     $this->_style->border_left_width,
285
-                                     $this->_style->border_right_width,
286
-                                     $this->_style->padding_left,
287
-                                     $this->_style->padding_right),
288
-                               $this->_containing_block["w"]);
289
-  }
290
-
291
-  // Return the padding box (x,y,w,h) of the frame
292
-  function get_padding_box() {
281
+                                        $this->_style->margin_left,
282
+                                        $this->_style->margin_right,
283
+                                        $this->_style->border_left_width,
284
+                                        $this->_style->border_right_width,
285
+                                        $this->_style->padding_left,
286
+                                        $this->_style->padding_right),
287
+                                $this->_containing_block["w"]);
288
+    }
289
+
290
+    // Return the padding box (x,y,w,h) of the frame
291
+    function get_padding_box() {
293 292
     $x = $this->_position["x"] +
294 293
       $this->_style->length_in_pt(array($this->_style->margin_left,
295 294
                                         $this->_style->border_left_width),
296
-                                  $this->_containing_block["w"]);
295
+                                    $this->_containing_block["w"]);
297 296
     $y = $this->_position["y"] +
298 297
       $this->_style->length_in_pt(array($this->_style->margin_top,
299 298
                                 $this->_style->border_top_width),
300
-                          $this->_containing_block["w"]);
299
+                            $this->_containing_block["w"]);
301 300
     
302 301
     $w = $this->_style->length_in_pt(array($this->_style->padding_left,
303
-                                   $this->_style->width,
304
-                                   $this->_style->padding_right),
305
-                             $this->_containing_block["w"]);
302
+                                    $this->_style->width,
303
+                                    $this->_style->padding_right),
304
+                                $this->_containing_block["w"]);
306 305
 
307 306
     $h = $this->_style->length_in_pt(array($this->_style->padding_top,
308
-                                   $this->_style->height,
309
-                                   $this->_style->padding_bottom),
310
-                             $this->_containing_block["w"]);
307
+                                    $this->_style->height,
308
+                                    $this->_style->padding_bottom),
309
+                                $this->_containing_block["w"]);
311 310
 
312 311
     return array(0 => $x, "x" => $x,
313
-                 1 => $y, "y" => $y,
314
-                 2 => $w, "w" => $w,
315
-                 3 => $h, "h" => $h);
316
-  }
312
+                    1 => $y, "y" => $y,
313
+                    2 => $w, "w" => $w,
314
+                    3 => $h, "h" => $h);
315
+    }
317 316
 
318
-  // Return the border box of the frame
319
-  function get_border_box() {
317
+    // Return the border box of the frame
318
+    function get_border_box() {
320 319
     $x = $this->_position["x"] +
321 320
       $this->_style->length_in_pt($this->_style->margin_left,
322
-                          $this->_containing_block["w"]);
321
+                            $this->_containing_block["w"]);
323 322
     $y = $this->_position["y"] +
324 323
       $this->_style->length_in_pt($this->_style->margin_top,
325
-                          $this->_containing_block["w"]);
324
+                            $this->_containing_block["w"]);
326 325
 
327 326
     $w = $this->_style->length_in_pt(array($this->_style->border_left_width,
328
-                                   $this->_style->padding_left,
329
-                                   $this->_style->width,
330
-                                   $this->_style->padding_right,
331
-                                   $this->_style->border_right_width),
332
-                             $this->_containing_block["w"]);
327
+                                    $this->_style->padding_left,
328
+                                    $this->_style->width,
329
+                                    $this->_style->padding_right,
330
+                                    $this->_style->border_right_width),
331
+                                $this->_containing_block["w"]);
333 332
 
334 333
     $h = $this->_style->length_in_pt(array($this->_style->border_top_width,
335
-                                   $this->_style->padding_top,
336
-                                   $this->_style->height,
337
-                                   $this->_style->padding_bottom,
338
-                                   $this->_style->border_bottom_width),
339
-                             $this->_containing_block["w"]);
334
+                                    $this->_style->padding_top,
335
+                                    $this->_style->height,
336
+                                    $this->_style->padding_bottom,
337
+                                    $this->_style->border_bottom_width),
338
+                                $this->_containing_block["w"]);
340 339
 
341 340
     return array(0 => $x, "x" => $x,
342
-                 1 => $y, "y" => $y,
343
-                 2 => $w, "w" => $w,
344
-                 3 => $h, "h" => $h);
341
+                    1 => $y, "y" => $y,
342
+                    2 => $w, "w" => $w,
343
+                    3 => $h, "h" => $h);
345 344
     
346
-  }
345
+    }
347 346
   
348
-  //........................................................................
347
+    //........................................................................
349 348
 
350
-  // Set methods
351
-  function set_id($id) {
349
+    // Set methods
350
+    function set_id($id) {
352 351
     $this->_id = $id;
353 352
 
354 353
     // We can only set attributes of DOMElement objects (nodeType == 1).
355 354
     // Since these are the only objects that we can assign CSS rules to,
356 355
     // this shortcoming is okay.
357 356
     if ( $this->_node->nodeType == 1)
358
-      $this->_node->setAttribute("frame_id", $id);
359
-  }
357
+        $this->_node->setAttribute("frame_id", $id);
358
+    }
360 359
 
361
-  function set_style(Style $style) {
360
+    function set_style(Style $style) {
362 361
     if ( is_null($this->_style) )
363
-      $this->_original_style = clone $style;
362
+        $this->_original_style = clone $style;
364 363
     
365 364
     $this->_style = $style;
366
-  }
365
+    }
367 366
   
368
-  function set_decorator(Frame_Decorator $decorator) {
367
+    function set_decorator(Frame_Decorator $decorator) {
369 368
     $this->_decorator = $decorator;
370
-  }
369
+    }
371 370
   
372
-  function set_containing_block($x = null, $y = null, $w = null, $h = null) {
371
+    function set_containing_block($x = null, $y = null, $w = null, $h = null) {
373 372
     if ( is_array($x) ){
374
-  		foreach($x AS $key => $val){
375
-			$$key = $val;
376
-		}
373
+            foreach($x AS $key => $val){
374
+            $$key = $val;
375
+        }
377 376
     }
378 377
     
379 378
     if (is_numeric($x)) {
380
-      $this->_containing_block[0] = $x;
381
-      $this->_containing_block["x"] = $x;
379
+        $this->_containing_block[0] = $x;
380
+        $this->_containing_block["x"] = $x;
382 381
     }
383 382
     
384 383
     if (is_numeric($y)) {
385
-      $this->_containing_block[1] = $y;
386
-      $this->_containing_block["y"] = $y;
384
+        $this->_containing_block[1] = $y;
385
+        $this->_containing_block["y"] = $y;
387 386
     }
388 387
     
389 388
     if (is_numeric($w)) {
390
-      $this->_containing_block[2] = $w;
391
-      $this->_containing_block["w"] = $w;
389
+        $this->_containing_block[2] = $w;
390
+        $this->_containing_block["w"] = $w;
392 391
     }
393 392
     
394 393
     if (is_numeric($h)) {
395
-      $this->_containing_block[3] = $h;
396
-      $this->_containing_block["h"] = $h;
394
+        $this->_containing_block[3] = $h;
395
+        $this->_containing_block["h"] = $h;
397 396
     }
398 397
     
399
-  }
398
+    }
400 399
 
401
-  function set_position($x = null, $y = null) {
400
+    function set_position($x = null, $y = null) {
402 401
     if ( is_array($x) )
403
-      extract($x);
402
+        extract($x);
404 403
     
405 404
     if ( is_numeric($x) ) {
406
-      $this->_position[0] = $x;
407
-      $this->_position["x"] = $x;
405
+        $this->_position[0] = $x;
406
+        $this->_position["x"] = $x;
408 407
     }
409 408
 
410 409
     if ( is_numeric($y) ) {
411
-      $this->_position[1] = $y;
412
-      $this->_position["y"] = $y;
410
+        $this->_position[1] = $y;
411
+        $this->_position["y"] = $y;
412
+    }
413 413
     }
414
-  }
415 414
 
416
-  //........................................................................
415
+    //........................................................................
417 416
 
418
-  function prepend_child(Frame $child, $update_node = true) {
417
+    function prepend_child(Frame $child, $update_node = true) {
419 418
 
420 419
     if ( $update_node ) 
421
-      $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
420
+        $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
422 421
 
423 422
     // Remove the child from its parent
424 423
     if ( $child->_parent )
425
-      $child->_parent->remove_child($child, false);
424
+        $child->_parent->remove_child($child, false);
426 425
     
427 426
     $child->_parent = $this;
428 427
     $child->_prev_sibling = null;
429 428
     
430 429
     // Handle the first child
431 430
     if ( !$this->_first_child ) {
432
-      $this->_first_child = $child;
433
-      $this->_last_child = $child;
434
-      $child->_next_sibling = null;
431
+        $this->_first_child = $child;
432
+        $this->_last_child = $child;
433
+        $child->_next_sibling = null;
435 434
       
436 435
     } else {
437 436
 
438
-      $this->_first_child->_prev_sibling = $child;
439
-      $child->_next_sibling = $this->_first_child;      
440
-      $this->_first_child = $child;
437
+        $this->_first_child->_prev_sibling = $child;
438
+        $child->_next_sibling = $this->_first_child;      
439
+        $this->_first_child = $child;
441 440
       
442 441
     }
443
-  }
442
+    }
444 443
   
445
-  function append_child(Frame $child, $update_node = true) {
444
+    function append_child(Frame $child, $update_node = true) {
446 445
 
447 446
     if ( $update_node ) 
448
-      $this->_node->appendChild($child->_node);
447
+        $this->_node->appendChild($child->_node);
449 448
 
450 449
     // Remove the child from its parent
451 450
     if ( $child->_parent )
452
-      $child->_parent->remove_child($child, false);
451
+        $child->_parent->remove_child($child, false);
453 452
 
454 453
     $child->_parent = $this;
455 454
     $child->_next_sibling = null;
456 455
     
457 456
     // Handle the first child
458 457
     if ( !$this->_last_child ) {
459
-      $this->_first_child = $child;
460
-      $this->_last_child = $child;
461
-      $child->_prev_sibling = null;
458
+        $this->_first_child = $child;
459
+        $this->_last_child = $child;
460
+        $child->_prev_sibling = null;
462 461
       
463 462
     } else {
464 463
 
465
-      $this->_last_child->_next_sibling = $child;
466
-      $child->_prev_sibling = $this->_last_child;
467
-      $this->_last_child = $child;
464
+        $this->_last_child->_next_sibling = $child;
465
+        $child->_prev_sibling = $this->_last_child;
466
+        $this->_last_child = $child;
468 467
 
469 468
     }
470
-  }  
469
+    }  
471 470
 
472
-  // Inserts a new child immediately before the specified frame
473
-  function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
471
+    // Inserts a new child immediately before the specified frame
472
+    function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
474 473
 
475 474
     if ( $ref === $this->_first_child ) {
476
-      $this->prepend_child($new_child, $update_node);
477
-      return;
475
+        $this->prepend_child($new_child, $update_node);
476
+        return;
478 477
     }
479 478
 
480 479
     if ( is_null($ref) ) {
481
-      $this->append_child($new_child, $update_node);
482
-      return;
480
+        $this->append_child($new_child, $update_node);
481
+        return;
483 482
     }
484 483
     
485 484
     if ( $ref->_parent !== $this )
486
-      throw new DOMPDF_Exception("Reference child is not a child of this node.");
485
+        throw new DOMPDF_Exception("Reference child is not a child of this node.");
487 486
 
488 487
     // Update the node    
489 488
     if ( $update_node )
490
-      $this->_node->insertBefore($new_child->_node, $ref->_node);
489
+        $this->_node->insertBefore($new_child->_node, $ref->_node);
491 490
 
492 491
     // Remove the child from its parent
493 492
     if ( $new_child->_parent )
494
-      $new_child->_parent->remove_child($new_child, false);
493
+        $new_child->_parent->remove_child($new_child, false);
495 494
     
496 495
     $new_child->_parent = $this;
497 496
     $new_child->_next_sibling = $ref;
498 497
     $new_child->_prev_sibling = $ref->_prev_sibling;
499 498
 
500 499
     if ( $ref->_prev_sibling )
501
-      $ref->_prev_sibling->_next_sibling = $new_child;
500
+        $ref->_prev_sibling->_next_sibling = $new_child;
502 501
     
503 502
     $ref->_prev_sibling = $new_child;
504
-  }
503
+    }
505 504
   
506
-  // Inserts a new child immediately after the specified frame
507
-  function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {    
505
+    // Inserts a new child immediately after the specified frame
506
+    function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {    
508 507
 
509 508
     if ( $ref === $this->_last_child ) {
510
-      $this->append_child($new_child, $update_node);
511
-      return;
509
+        $this->append_child($new_child, $update_node);
510
+        return;
512 511
     }
513 512
 
514 513
     if ( is_null($ref) ) {
515
-      $this->prepend_child($new_child, $update_node);
516
-      return;
514
+        $this->prepend_child($new_child, $update_node);
515
+        return;
517 516
     }
518 517
     
519 518
     if ( $ref->_parent !== $this )
520
-      throw new DOMPDF_Exception("Reference child is not a child of this node.");
519
+        throw new DOMPDF_Exception("Reference child is not a child of this node.");
521 520
 
522 521
     // Update the node
523 522
     if ( $update_node ) {
524
-      if ( $ref->_next_sibling ) {
523
+        if ( $ref->_next_sibling ) {
525 524
         $next_node = $ref->_next_sibling->_node;
526 525
         $this->_node->insertBefore($new_child->_node, $next_node);
527
-      } else {
526
+        } else {
528 527
         $new_child->_node = $this->_node->appendChild($new_child);
529
-      }
528
+        }
530 529
     }
531 530
     
532 531
     // Remove the child from its parent
533 532
     if ( $new_child->_parent)
534
-      $new_child->_parent->remove_child($new_child, false);
533
+        $new_child->_parent->remove_child($new_child, false);
535 534
     
536 535
     $new_child->_parent = $this;
537 536
     $new_child->_prev_sibling = $ref;
538 537
     $new_child->_next_sibling = $ref->_next_sibling;
539 538
 
540 539
     if ( $ref->_next_sibling ) 
541
-      $ref->_next_sibling->_prev_sibling = $new_child;
540
+        $ref->_next_sibling->_prev_sibling = $new_child;
542 541
 
543 542
     $ref->_next_sibling = $new_child;
544
-  }
543
+    }
545 544
 
546 545
 
547
-  function remove_child(Frame $child, $update_node = true) {
546
+    function remove_child(Frame $child, $update_node = true) {
548 547
 
549 548
     if ( $child->_parent !== $this )
550
-      throw new DOMPDF_Exception("Child not found in this frame");
549
+        throw new DOMPDF_Exception("Child not found in this frame");
551 550
 
552 551
     if ( $update_node )
553
-      $this->_node->removeChild($child->_node);
552
+        $this->_node->removeChild($child->_node);
554 553
     
555 554
     if ( $child === $this->_first_child )
556
-      $this->_first_child = $child->_next_sibling;
555
+        $this->_first_child = $child->_next_sibling;
557 556
 
558 557
     if ( $child === $this->_last_child )
559
-      $this->_last_child = $child->_prev_sibling;
558
+        $this->_last_child = $child->_prev_sibling;
560 559
 
561 560
     if ( $child->_prev_sibling )
562
-      $child->_prev_sibling->_next_sibling = $child->_next_sibling;
561
+        $child->_prev_sibling->_next_sibling = $child->_next_sibling;
563 562
 
564 563
     if ( $child->_next_sibling )
565
-      $child->_next_sibling->_prev_sibling = $child->_prev_sibling;    
564
+        $child->_next_sibling->_prev_sibling = $child->_prev_sibling;    
566 565
 
567 566
     $child->_next_sibling = null;
568 567
     $child->_prev_sibling = null;
569 568
     $child->_parent = null;
570 569
     return $child;
571 570
         
572
-  }
571
+    }
573 572
 
574
-  //........................................................................
573
+    //........................................................................
575 574
 
576
-  // Debugging function:
577
-  function __toString() {
575
+    // Debugging function:
576
+    function __toString() {
578 577
 
579 578
     // Skip empty text frames
580 579
 //     if ( $this->_node->nodeName === "#text" &&
@@ -588,29 +587,29 @@  discard block
 block discarded – undo
588 587
     $str .= "Class: " .get_class($this) . "<br/>";
589 588
     
590 589
     if ( $this->_node->nodeName === "#text" ) {
591
-      $tmp = htmlspecialchars($this->_node->nodeValue);
592
-      $str .= "<pre>'" .  mb_substr($tmp,0,70) .
590
+        $tmp = htmlspecialchars($this->_node->nodeValue);
591
+        $str .= "<pre>'" .  mb_substr($tmp,0,70) .
593 592
         (mb_strlen($tmp) > 70 ? "..." : "") . "'</pre>";
594 593
     }
595 594
     if ( $this->_parent )
596
-      $str .= "\nParent:" . $this->_parent->_node->nodeName .
595
+        $str .= "\nParent:" . $this->_parent->_node->nodeName .
597 596
         " (" . spl_object_hash($this->_parent->_node) . ") " .
598 597
         "<br/>";
599 598
 
600 599
     if ( $this->_prev_sibling )
601
-      $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
600
+        $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
602 601
         " (" . spl_object_hash($this->_prev_sibling->_node) . ") " .
603 602
         "<br/>";
604 603
 
605 604
     if ( $this->_next_sibling )
606
-      $str .= "Next: " . $this->_next_sibling->_node->nodeName .
605
+        $str .= "Next: " . $this->_next_sibling->_node->nodeName .
607 606
         " (" . spl_object_hash($this->_next_sibling->_node) . ") " .
608 607
         "<br/>";
609 608
 
610 609
     $d = $this->get_decorator();
611 610
     while ($d && $d != $d->get_decorator()) {
612
-      $str .= "Decorator: " . get_class($d) . "<br/>";
613
-      $d = $d->get_decorator();
611
+        $str .= "Decorator: " . get_class($d) . "<br/>";
612
+        $d = $d->get_decorator();
614 613
     }
615 614
 
616 615
     $str .= "Position: " . pre_r($this->_position, true);
@@ -621,33 +620,33 @@  discard block
 block discarded – undo
621 620
     $str .= "\nStyle: <pre>". $this->_style->__toString() . "</pre>";
622 621
 
623 622
     if ( $this->_decorator instanceof Block_Frame_Decorator ) {
624
-      $str .= "Lines:<pre>";
625
-      foreach ($this->_decorator->get_lines() as $line) {
623
+        $str .= "Lines:<pre>";
624
+        foreach ($this->_decorator->get_lines() as $line) {
626 625
         foreach ($line["frames"] as $frame) {
627
-          if ($frame instanceof Text_Frame_Decorator) {
626
+            if ($frame instanceof Text_Frame_Decorator) {
628 627
             $str .= "\ntext: ";          
629 628
             $str .= "'". htmlspecialchars($frame->get_text()) ."'";
630
-          } else {
629
+            } else {
631 630
             $str .= "\nBlock: " . $frame->get_node()->nodeName . " (" . spl_object_hash($frame->get_node()) . ")";
632
-          }
631
+            }
633 632
         }
634 633
         
635 634
         $str .=
636
-          //"\ncount => " . $line["count"] . "\n".
637
-          "\ny => " . $line["y"] . "\n" .
638
-          "w => " . $line["w"] . "\n" .
639
-          "h => " . $line["h"] . "\n";
640
-      }
641
-      $str .= "</pre>";
635
+            //"\ncount => " . $line["count"] . "\n".
636
+            "\ny => " . $line["y"] . "\n" .
637
+            "w => " . $line["w"] . "\n" .
638
+            "h => " . $line["h"] . "\n";
639
+        }
640
+        $str .= "</pre>";
642 641
     }
643 642
     $str .= "\n";
644 643
     if ( php_sapi_name() === "cli" )
645
-      $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
644
+        $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
646 645
                                     array("\n","",""),
647 646
                                     $str));
648 647
     
649 648
     return $str;
650
-  }
649
+    }
651 650
         
652 651
 }
653 652
 
@@ -660,10 +659,10 @@  discard block
 block discarded – undo
660 659
  * @package dompdf
661 660
  */
662 661
 class FrameList implements IteratorAggregate {
663
-  protected $_frame;
662
+    protected $_frame;
664 663
 
665
-  function __construct($frame) { $this->_frame = $frame; }
666
-  function getIterator() { return new FrameListIterator($this->_frame); }
664
+    function __construct($frame) { $this->_frame = $frame; }
665
+    function getIterator() { return new FrameListIterator($this->_frame); }
667 666
 }
668 667
   
669 668
 /**
@@ -677,37 +676,37 @@  discard block
 block discarded – undo
677 676
  */
678 677
 class FrameListIterator implements Iterator {
679 678
 
680
-  protected $_parent;
681
-  protected $_cur;
682
-  protected $_num;
679
+    protected $_parent;
680
+    protected $_cur;
681
+    protected $_num;
683 682
 
684
-  function __construct(Frame $frame) {
683
+    function __construct(Frame $frame) {
685 684
     $this->_parent = $frame;
686 685
     $this->_cur = $frame->get_first_child();
687 686
     $this->_num = 0;
688
-  }
687
+    }
689 688
 
690
-  function rewind() { 
689
+    function rewind() { 
691 690
     $this->_cur = $this->_parent->get_first_child();
692 691
     $this->_num = 0;
693
-  }
692
+    }
694 693
 
695
-  function valid() {
694
+    function valid() {
696 695
     return isset($this->_cur);// && ($this->_cur->get_prev_sibling() === $this->_prev);
697
-  }
698
-  function key() { return $this->_num; }
699
-  function current() { return $this->_cur; }
696
+    }
697
+    function key() { return $this->_num; }
698
+    function current() { return $this->_cur; }
700 699
 
701
-  function next() {
700
+    function next() {
702 701
 
703 702
     $ret = $this->_cur;
704 703
     if ( !$ret )
705
-      return null;
704
+        return null;
706 705
     
707 706
     $this->_cur = $this->_cur->get_next_sibling();
708 707
     $this->_num++;
709 708
     return $ret;
710
-  }
709
+    }
711 710
 }
712 711
 
713 712
 //------------------------------------------------------------------------
@@ -720,9 +719,9 @@  discard block
 block discarded – undo
720 719
  */
721 720
 class FrameTreeList implements IteratorAggregate {
722 721
 
723
-  protected $_root;
724
-  function __construct(Frame $root) { $this->_root = $root; }
725
-  function getIterator() { return new FrameTreeIterator($this->_root); }
722
+    protected $_root;
723
+    function __construct(Frame $root) { $this->_root = $root; }
724
+    function getIterator() { return new FrameTreeIterator($this->_root); }
726 725
 
727 726
 }
728 727
 
@@ -736,25 +735,25 @@  discard block
 block discarded – undo
736 735
  */
737 736
 class FrameTreeIterator implements Iterator {
738 737
 
739
-  protected $_root;
740
-  protected $_stack = array();
741
-  protected $_num;
738
+    protected $_root;
739
+    protected $_stack = array();
740
+    protected $_num;
742 741
   
743
-  function __construct(Frame $root) {
742
+    function __construct(Frame $root) {
744 743
     $this->_stack[] = $this->_root = $root;
745 744
     $this->_num = 0;
746
-  }
745
+    }
747 746
 
748
-  function rewind() {
747
+    function rewind() {
749 748
     $this->_stack = array($this->_root);
750 749
     $this->_num = 0;
751
-  }
750
+    }
752 751
     
753
-  function valid() { return count($this->_stack) > 0; }
754
-  function key() { return $this->_num; }
755
-  function current() { return end($this->_stack); }
752
+    function valid() { return count($this->_stack) > 0; }
753
+    function key() { return $this->_num; }
754
+    function current() { return end($this->_stack); }
756 755
 
757
-  function next() {
756
+    function next() {
758 757
     $b = end($this->_stack);
759 758
     
760 759
     // Pop last element
@@ -763,10 +762,10 @@  discard block
 block discarded – undo
763 762
     
764 763
     // Push all children onto the stack in reverse order
765 764
     if ( $c = $b->get_last_child() ) {
766
-      $this->_stack[] = $c;
767
-      while ( $c = $c->get_prev_sibling() )
765
+        $this->_stack[] = $c;
766
+        while ( $c = $c->get_prev_sibling() )
768 767
         $this->_stack[] = $c;
769 768
     }
770 769
     return $b;
771
-  }
770
+    }
772 771
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_reflower.cls.php 1 patch
Indentation   +67 added lines, -68 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: frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -50,30 +49,30 @@  discard block
 block discarded – undo
50 49
  */
51 50
 abstract class Frame_Reflower {
52 51
 
53
-  /**
54
-   * Frame for this reflower
55
-   *
56
-   * @var Frame
57
-   */
58
-  protected $_frame;
59
-
60
-  /**
61
-   * Cached min/max size
62
-   *
63
-   * @var array
64
-   */
65
-  protected $_min_max_cache;
52
+    /**
53
+     * Frame for this reflower
54
+     *
55
+     * @var Frame
56
+     */
57
+    protected $_frame;
58
+
59
+    /**
60
+     * Cached min/max size
61
+     *
62
+     * @var array
63
+     */
64
+    protected $_min_max_cache;
66 65
   
67
-  function __construct(Frame $frame) {
66
+    function __construct(Frame $frame) {
68 67
     $this->_frame = $frame;
69 68
     $this->_min_max_cache = null;
70
-  }
69
+    }
71 70
 
72
-  function dispose() {
71
+    function dispose() {
73 72
     unset($this->_frame);
74
-  }
73
+    }
75 74
 
76
-  protected function _collapse_margins() {
75
+    protected function _collapse_margins() {
77 76
     $cb = $this->_frame->get_containing_block();
78 77
     $style = $this->_frame->get_style();
79 78
 
@@ -82,121 +81,121 @@  discard block
 block discarded – undo
82 81
 
83 82
     // Handle 'auto' values
84 83
     if ( $t === "auto" ) {
85
-      $style->margin_top = "0pt";
86
-      $t = 0;
84
+        $style->margin_top = "0pt";
85
+        $t = 0;
87 86
     }
88 87
 
89 88
     if ( $b === "auto" ) {
90
-      $style->margin_bottom = "0pt";
91
-      $b = 0;
89
+        $style->margin_bottom = "0pt";
90
+        $b = 0;
92 91
     }
93 92
 
94 93
     // Collapse vertical margins:
95 94
     $n = $this->_frame->get_next_sibling();
96 95
     while ( $n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES) )
97
-      $n = $n->get_next_sibling();
96
+        $n = $n->get_next_sibling();
98 97
 
99 98
     if ( $n ) { // && !$n instanceof Page_Frame_Decorator ) {
100 99
 
101
-      $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"]));
100
+        $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"]));
102 101
 
103
-      $n->get_style()->margin_top = "$b pt";
104
-      $style->margin_bottom = "0 pt";
102
+        $n->get_style()->margin_top = "$b pt";
103
+        $style->margin_bottom = "0 pt";
105 104
 
106 105
     }
107 106
 
108 107
     // Collapse our first child's margin
109 108
     $f = $this->_frame->get_first_child();
110 109
     while ( $f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES) )
111
-      $f = $f->get_next_sibling();
110
+        $f = $f->get_next_sibling();
112 111
 
113 112
     if ( $f ) {
114
-      $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"]));
115
-      $style->margin_top = "$t pt";
116
-      $f->get_style()->margin_top = "0 pt";
113
+        $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"]));
114
+        $style->margin_top = "$t pt";
115
+        $f->get_style()->margin_top = "0 pt";
117 116
     }
118 117
 
119
-  }
118
+    }
120 119
 
121
-  // Returns true if a new page is required
122
-  protected function _check_new_page() {
120
+    // Returns true if a new page is required
121
+    protected function _check_new_page() {
123 122
     $y = $this->_frame->get_position("y");
124 123
     $h = $style->length_in_pt($style->height);
125 124
     // Check if we need to move to a new page
126 125
     if ( $y + $h >= $this->_frame->get_root()->get_page_height() )
127
-      return true;
126
+        return true;
128 127
 
129
-  }
128
+    }
130 129
 
131
-  //........................................................................
130
+    //........................................................................
132 131
 
133
-  abstract function reflow();
132
+    abstract function reflow();
134 133
 
135
-  //........................................................................
134
+    //........................................................................
136 135
 
137
-  // Required for table layout: Returns an array(0 => min, 1 => max, "min"
138
-  // => min, "max" => max) of the minimum and maximum widths of this frame.
139
-  // This provides a basic implementation.  Child classes should override
140
-  // this if necessary.
141
-  function get_min_max_width() {
136
+    // Required for table layout: Returns an array(0 => min, 1 => max, "min"
137
+    // => min, "max" => max) of the minimum and maximum widths of this frame.
138
+    // This provides a basic implementation.  Child classes should override
139
+    // this if necessary.
140
+    function get_min_max_width() {
142 141
     if ( !is_null($this->_min_max_cache) ) {
143
-      return $this->_min_max_cache;
142
+        return $this->_min_max_cache;
144 143
     }
145 144
     
146 145
     $style = $this->_frame->get_style();
147 146
 
148 147
     // Account for margins & padding
149 148
     $dims = array($style->padding_left,
150
-                  $style->padding_right,
151
-                  $style->border_left_width,
152
-                  $style->border_right_width,
153
-                  $style->margin_left,
154
-                  $style->margin_right);
149
+                    $style->padding_right,
150
+                    $style->border_left_width,
151
+                    $style->border_right_width,
152
+                    $style->margin_left,
153
+                    $style->margin_right);
155 154
 
156 155
     $cb_w = $this->_frame->get_containing_block("w");
157 156
     $delta = $style->length_in_pt($dims, $cb_w);
158 157
 
159 158
     // Handle degenerate case
160 159
     if ( !$this->_frame->get_first_child() )
161
-      return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta);
160
+        return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta);
162 161
 
163 162
     $low = array();
164 163
     $high = array();
165 164
 
166 165
     for ( $iter = $this->_frame->get_children()->getIterator();
167
-          $iter->valid();
168
-          $iter->next() ) {
166
+            $iter->valid();
167
+            $iter->next() ) {
169 168
 
170
-      $inline_min = 0;
171
-      $inline_max = 0;
169
+        $inline_min = 0;
170
+        $inline_max = 0;
172 171
 
173
-      // Add all adjacent inline widths together to calculate max width
174
-      while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) {
172
+        // Add all adjacent inline widths together to calculate max width
173
+        while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) {
175 174
 
176 175
         $child = $iter->current();
177 176
 
178 177
         $minmax = $child->get_min_max_width();
179 178
 
180 179
         if ( in_array( $iter->current()->get_style()->white_space, array("pre", "nowrap") ) )
181
-          $inline_min += $minmax["min"];
180
+            $inline_min += $minmax["min"];
182 181
         else
183
-          $low[] = $minmax["min"];
182
+            $low[] = $minmax["min"];
184 183
 
185 184
         $inline_max += $minmax["max"];
186 185
         $iter->next();
187 186
 
188
-      }
187
+        }
189 188
 
190
-      if ( $inline_max > 0 )
189
+        if ( $inline_max > 0 )
191 190
         $high[] = $inline_max;
192 191
 
193
-      if ( $inline_min > 0 )
192
+        if ( $inline_min > 0 )
194 193
         $low[] = $inline_min;
195 194
 
196
-      if ( $iter->valid() ) {
195
+        if ( $iter->valid() ) {
197 196
         list($low[], $high[]) = $iter->current()->get_min_max_width();
198 197
         continue;
199
-      }
198
+        }
200 199
 
201 200
     }
202 201
     $min = count($low) ? max($low) : 0;
@@ -206,16 +205,16 @@  discard block
 block discarded – undo
206 205
     // content.  If the width is a percentage ignore it for now.
207 206
     $width = $style->width;
208 207
     if ( $width !== "auto" && !is_percent($width) ) {
209
-      $width = $style->length_in_pt($width, $cb_w);
210
-      if ( $min < $width )
208
+        $width = $style->length_in_pt($width, $cb_w);
209
+        if ( $min < $width )
211 210
         $min = $width;
212
-      if ( $max < $width )
211
+        if ( $max < $width )
213 212
         $max = $width;
214 213
     }
215 214
 
216 215
     $min += $delta;
217 216
     $max += $delta;
218 217
     return $this->_min_max_cache = array($min, $max, "min"=>$min, "max"=>$max);
219
-  }
218
+    }
220 219
 
221 220
 }
Please login to merge, or discard this patch.
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/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/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.