Passed
Push — 1.10.x ( 5654d2...115d5a )
by Yannick
263:14 queued 212:07
created
main/inc/lib/phpdocx/pdf/include/image_frame_reflower.cls.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
  */
55 55
 class Image_Frame_Reflower extends Frame_Reflower {
56 56
 
57
-  function __construct(Image_Frame_Decorator $frame) {
57
+    function __construct(Image_Frame_Decorator $frame) {
58 58
     parent::__construct($frame);
59
-  }
59
+    }
60 60
 
61
-  function reflow() {
61
+    function reflow() {
62 62
     
63 63
     // Set the frame's width
64 64
     $this->get_min_max_width();
65 65
     
66
-  }
66
+    }
67 67
 
68
-  function get_min_max_width() {
68
+    function get_min_max_width() {
69 69
 
70 70
     if (DEBUGPNG) {
71
-      // Determine the image's size. Time consuming. Only when really needed?
72
-      list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
73
-      print "get_min_max_width() ".
71
+        // Determine the image's size. Time consuming. Only when really needed?
72
+        list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
73
+        print "get_min_max_width() ".
74 74
         $this->_frame->get_style()->width.' '.
75 75
         $this->_frame->get_style()->height.';'.
76 76
         $this->_frame->get_parent()->get_style()->width." ".
@@ -93,55 +93,55 @@  discard block
 block discarded – undo
93 93
 
94 94
     $width = ($style->width > 0 ? $style->width : ($stylep->width > 0 ? $stylep->width : 0));
95 95
     if ( is_percent($width) ) {
96
-      $t = 0.0;
97
-      for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
96
+        $t = 0.0;
97
+        for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
98 98
         $t = (float)($f->get_style()->width); //always in pt
99 99
         if ((float)$t != 0) {
100
-        	break;
100
+            break;
101
+        }
101 102
         }
102
-      }
103
-      $width = ((float)rtrim($width,"%") * $t)/100; //maybe 0
103
+        $width = ((float)rtrim($width,"%") * $t)/100; //maybe 0
104 104
     } else {
105
-      // Don't set image original size if "%" branch was 0 or size not given.
106
-      // Otherwise aspect changed on %/auto combination for width/height
107
-      // Resample according to px per inch
108
-      // See also List_Bullet_Image_Frame_Decorator::__construct
109
-      $width = (float)($width * 72) / DOMPDF_DPI;
105
+        // Don't set image original size if "%" branch was 0 or size not given.
106
+        // Otherwise aspect changed on %/auto combination for width/height
107
+        // Resample according to px per inch
108
+        // See also List_Bullet_Image_Frame_Decorator::__construct
109
+        $width = (float)($width * 72) / DOMPDF_DPI;
110 110
     }
111 111
 
112 112
     $height = ($style->height > 0 ? $style->height : ($stylep->height > 0 ? $stylep->height : 0));
113 113
     if ( is_percent($height) ) {
114
-      $t = 0.0;
115
-      for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
114
+        $t = 0.0;
115
+        for ($f = $this->_frame->get_parent(); $f; $f = $f->get_parent()) {
116 116
         $t = (float)($f->get_style()->height); //always in pt
117 117
         if ((float)$t != 0) {
118
-        	break;
118
+            break;
119 119
         }
120
-      }
121
-      $height = ((float)rtrim($height,"%") * $t)/100; //maybe 0
120
+        }
121
+        $height = ((float)rtrim($height,"%") * $t)/100; //maybe 0
122 122
     } else {
123
-      // Don't set image original size if "%" branch was 0 or size not given.
124
-      // Otherwise aspect changed on %/auto combination for width/height
125
-      // Resample according to px per inch
126
-      // See also List_Bullet_Image_Frame_Decorator::__construct
127
-      $height = (float)($height * 72) / DOMPDF_DPI;
123
+        // Don't set image original size if "%" branch was 0 or size not given.
124
+        // Otherwise aspect changed on %/auto combination for width/height
125
+        // Resample according to px per inch
126
+        // See also List_Bullet_Image_Frame_Decorator::__construct
127
+        $height = (float)($height * 72) / DOMPDF_DPI;
128 128
     }
129 129
 
130 130
     if ($width == 0 || $height == 0) {
131
-      // Determine the image's size. Time consuming. Only when really needed!
132
-      list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
133
-      // don't treat 0 as error. Can be downscaled or can be catched elsewhere if image not readable.
134
-      // Resample according to px per inch
135
-      // See also List_Bullet_Image_Frame_Decorator::__construct
131
+        // Determine the image's size. Time consuming. Only when really needed!
132
+        list($img_width, $img_height) = getimagesize($this->_frame->get_image_url());
133
+        // don't treat 0 as error. Can be downscaled or can be catched elsewhere if image not readable.
134
+        // Resample according to px per inch
135
+        // See also List_Bullet_Image_Frame_Decorator::__construct
136 136
       
137
-      if ($width == 0 && $height == 0) {
137
+        if ($width == 0 && $height == 0) {
138 138
         $width = (float)($img_width * 72) / DOMPDF_DPI;
139 139
         $height = (float)($img_height * 72) / DOMPDF_DPI;
140
-      } elseif ($height == 0 && $width != 0) {
140
+        } elseif ($height == 0 && $width != 0) {
141 141
         $height = ($width / $img_width) * $img_height; //keep aspect ratio
142
-      } elseif ($width == 0 && $height != 0) {
142
+        } elseif ($width == 0 && $height != 0) {
143 143
         $width = ($height / $img_height) * $img_width; //keep aspect ratio
144
-      }
144
+        }
145 145
     }
146 146
 
147 147
     if (DEBUGPNG) print $width.' '.$height.';';
@@ -173,5 +173,5 @@  discard block
 block discarded – undo
173 173
 
174 174
     return array( $width, $width, "min" => $width, "max" => $width);
175 175
     
176
-  }
176
+    }
177 177
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/page_frame_reflower.cls.php 1 patch
Indentation   +93 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: page_frame_reflower.cls.php,v $
6
- * Created on: 2004-06-16
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: page_frame_reflower.cls.php,v $
6
+     * Created on: 2004-06-16
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: page_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -47,25 +46,25 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Page_Frame_Reflower extends Frame_Reflower {
49 48
 
50
-  /**
51
-   * Cache of the callbacks array
52
-   * 
53
-   * @var array
54
-   */
55
-  private $_callbacks;
49
+    /**
50
+     * Cache of the callbacks array
51
+     * 
52
+     * @var array
53
+     */
54
+    private $_callbacks;
56 55
   
57
-  /**
58
-   * Cache of the canvas
59
-   *
60
-   * @var Canvas
61
-   */
62
-  private $_canvas;
56
+    /**
57
+     * Cache of the canvas
58
+     *
59
+     * @var Canvas
60
+     */
61
+    private $_canvas;
63 62
 
64
-  function __construct(Page_Frame_Decorator $frame) { parent::__construct($frame); }
63
+    function __construct(Page_Frame_Decorator $frame) { parent::__construct($frame); }
65 64
   
66
-  //........................................................................
65
+    //........................................................................
67 66
 
68
-  function reflow() {
67
+    function reflow() {
69 68
     $style = $this->_frame->get_style();
70 69
     
71 70
     // Paged layout:
@@ -88,74 +87,74 @@  discard block
 block discarded – undo
88 87
 
89 88
     while ($child) {
90 89
 
91
-      $child->set_containing_block($content_x, $content_y, $content_width, $content_height);
90
+        $child->set_containing_block($content_x, $content_y, $content_width, $content_height);
92 91
       
93
-      // Check for begin reflow callback
94
-      $this->_check_callbacks("begin_page_reflow", $child);
92
+        // Check for begin reflow callback
93
+        $this->_check_callbacks("begin_page_reflow", $child);
95 94
       
96
-      $child->reflow();
97
-      $next_child = $child->get_next_sibling();
95
+        $child->reflow();
96
+        $next_child = $child->get_next_sibling();
98 97
       
99
-      // Check for begin render callback
100
-      $this->_check_callbacks("begin_page_render", $child);
98
+        // Check for begin render callback
99
+        $this->_check_callbacks("begin_page_render", $child);
101 100
       
102
-      // Render the page
103
-      $this->_frame->get_renderer()->render($child);
101
+        // Render the page
102
+        $this->_frame->get_renderer()->render($child);
104 103
       
105
-      // Check for end render callback
106
-      $this->_check_callbacks("end_page_render", $child);
104
+        // Check for end render callback
105
+        $this->_check_callbacks("end_page_render", $child);
107 106
       
108
-      if ( $next_child )
109
-      {
107
+        if ( $next_child )
108
+        {
110 109
         $this->_frame->next_page();
111
-      }
110
+        }
112 111
 
113
-      // Wait to dispose of all frames on the previous page
114
-      // so callback will have access to them
115
-      if ( $prev_child )
116
-      {
112
+        // Wait to dispose of all frames on the previous page
113
+        // so callback will have access to them
114
+        if ( $prev_child )
115
+        {
117 116
         $prev_child->dispose(true);
118
-      }
119
-      $prev_child = $child;
120
-      $child = $next_child;
117
+        }
118
+        $prev_child = $child;
119
+        $child = $next_child;
121 120
     }
122 121
 
123 122
     // Dispose of previous page if it still exists
124 123
     if ( $prev_child )
125 124
     {
126
-      $prev_child->dispose(true);
125
+        $prev_child->dispose(true);
127 126
     }
128
-  }  
127
+    }  
129 128
   
130
-  //........................................................................
129
+    //........................................................................
131 130
   
132
-  /**
133
-   * Check for callbacks that need to be performed when a given event
134
-   * gets triggered on a page
135
-   *
136
-   * @param string $event the type of event
137
-   * @param Frame $frame the frame that event is triggered on
138
-   */
139
-  protected function _check_callbacks($event, $frame) {
131
+    /**
132
+     * Check for callbacks that need to be performed when a given event
133
+     * gets triggered on a page
134
+     *
135
+     * @param string $event the type of event
136
+     * @param Frame $frame the frame that event is triggered on
137
+     */
138
+    protected function _check_callbacks($event, $frame) {
140 139
     if (!isset($this->_callbacks)) {
141
-      $dompdf = $this->_frame->get_dompdf();
142
-      $this->_callbacks = $dompdf->get_callbacks();
143
-      $this->_canvas = $dompdf->get_canvas();
140
+        $dompdf = $this->_frame->get_dompdf();
141
+        $this->_callbacks = $dompdf->get_callbacks();
142
+        $this->_canvas = $dompdf->get_canvas();
144 143
     }
145 144
     
146 145
     if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) {
147
-      $info = array(0 => $this->_canvas, "canvas" => $this->_canvas,
146
+        $info = array(0 => $this->_canvas, "canvas" => $this->_canvas,
148 147
                     1 => $frame, "frame" => $frame);
149
-      $fs = $this->_callbacks[$event];
150
-      foreach ($fs as $f) {
148
+        $fs = $this->_callbacks[$event];
149
+        foreach ($fs as $f) {
151 150
         if (is_callable($f)) {
152
-          if (is_array($f)) {
151
+            if (is_array($f)) {
153 152
             $f[0]->$f[1]($info);
154
-          } else {
153
+            } else {
155 154
             $f($info);
156
-          }
155
+            }
156
+        }
157 157
         }
158
-      }
159 158
     }
160
-  }  
159
+    }  
161 160
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_frame_decorator.cls.php 1 patch
Indentation   +53 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,47 +1,46 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: inline_frame_decorator.cls.php,v $
6
- * Created on: 2004-06-02
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @contributor Helmut Tischer <[email protected]>
37
- * @package dompdf
38
-
39
- *
40
- * Changes
41
- * @contributor Helmut Tischer <[email protected]>
42
- * @version 20090610
43
- * - don't repeat non repeatable background images after a line break
44
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: inline_frame_decorator.cls.php,v $
6
+     * Created on: 2004-06-02
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @contributor Helmut Tischer <[email protected]>
37
+     * @package dompdf
38
+     *
39
+     * Changes
40
+     * @contributor Helmut Tischer <[email protected]>
41
+     * @version 20090610
42
+     * - don't repeat non repeatable background images after a line break
43
+     */
45 44
 
46 45
 /* $Id: inline_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
47 46
 
@@ -53,17 +52,17 @@  discard block
 block discarded – undo
53 52
  */
54 53
 class Inline_Frame_Decorator extends Frame_Decorator {
55 54
   
56
-  function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); }
55
+    function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); }
57 56
 
58
-  function split($frame = null) {
57
+    function split($frame = null) {
59 58
 
60 59
     if ( is_null($frame) ) {
61
-      $this->get_parent()->split($this);
62
-      return;
60
+        $this->get_parent()->split($this);
61
+        return;
63 62
     }
64 63
     
65 64
     if ( $frame->get_parent() !== $this )
66
-      throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
65
+        throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
67 66
         
68 67
     $split = $this->copy( $this->_frame->get_node()->cloneNode() ); 
69 68
     $this->get_parent()->insert_child_after($split, $this);
@@ -86,18 +85,18 @@  discard block
 block discarded – undo
86 85
     //See e.g. in testcase image_variants, long desriptions
87 86
     if ( ($url = $style->background_image) && $url !== "none"
88 87
          && ($repeat = $style->background_repeat) && $repeat !== "repeat" &&  $repeat !== "repeat-y"
89
-       ) {
90
-      $style->background_image = "none";
88
+        ) {
89
+        $style->background_image = "none";
91 90
     }           
92 91
 
93 92
     // Add $frame and all following siblings to the new split node
94 93
     $iter = $frame;
95 94
     while ($iter) {
96
-      $frame = $iter;      
97
-      $iter = $iter->get_next_sibling();
98
-      $frame->reset();
99
-      $split->append_child($frame);
95
+        $frame = $iter;      
96
+        $iter = $iter->get_next_sibling();
97
+        $frame->reset();
98
+        $split->append_child($frame);
99
+    }
100 100
     }
101
-  }
102 101
   
103 102
 } 
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/null_positioner.cls.php 1 patch
Indentation   +38 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: null_positioner.cls.php,v $
6
- * Created on: 2004-07-12
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: null_positioner.cls.php,v $
6
+     * Created on: 2004-07-12
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: null_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -47,10 +46,10 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Null_Positioner extends Positioner {
49 48
 
50
-  function __construct(Frame_Decorator $frame) {
49
+    function __construct(Frame_Decorator $frame) {
51 50
     parent::__construct($frame);
52
-  }
51
+    }
53 52
 
54
-  function position() { return; }
53
+    function position() { return; }
55 54
   
56 55
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/list_bullet_image_frame_decorator.cls.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -52,34 +52,34 @@  discard block
 block discarded – undo
52 52
  */
53 53
 class List_Bullet_Image_Frame_Decorator extends Frame_Decorator {
54 54
 
55
-  /**
56
-   * The underlying image frame
57
-   * 
58
-   * @var Image_Frame_Decorator
59
-   */
60
-  protected $_img;
55
+    /**
56
+     * The underlying image frame
57
+     * 
58
+     * @var Image_Frame_Decorator
59
+     */
60
+    protected $_img;
61 61
 
62
-  /**
63
-   * The image's width in pixels
64
-   *
65
-   * @var int
66
-   */
67
-  protected $_width;
62
+    /**
63
+     * The image's width in pixels
64
+     *
65
+     * @var int
66
+     */
67
+    protected $_width;
68 68
   
69
-  /**
70
-   * The image's height in pixels
71
-   *
72
-   * @var int
73
-   */
74
-  protected $_height;
69
+    /**
70
+     * The image's height in pixels
71
+     *
72
+     * @var int
73
+     */
74
+    protected $_height;
75 75
 
76
-  /**
77
-   * Class constructor
78
-   *
79
-   * @param Frame $frame the bullet frame to decorate
80
-   * @param DOMPDF $dompdf the document's dompdf object
81
-   */
82
-  function __construct(Frame $frame, DOMPDF $dompdf) {
76
+    /**
77
+     * Class constructor
78
+     *
79
+     * @param Frame $frame the bullet frame to decorate
80
+     * @param DOMPDF $dompdf the document's dompdf object
81
+     */
82
+    function __construct(Frame $frame, DOMPDF $dompdf) {
83 83
     $style = $frame->get_style();
84 84
     $url = $style->list_style_image;
85 85
     $frame->get_node()->setAttribute("src", $url);
@@ -104,38 +104,38 @@  discard block
 block discarded – undo
104 104
     //  $style->min_height = $this->_height;
105 105
     //}
106 106
     //$style->height = "auto";   
107
-  }
107
+    }
108 108
 
109
-  /**
110
-   * Return the bullet's width
111
-   *
112
-   * @return int
113
-   */
114
-  function get_width() {
109
+    /**
110
+     * Return the bullet's width
111
+     *
112
+     * @return int
113
+     */
114
+    function get_width() {
115 115
     //ignore image width, use same width as on predefined bullet List_Bullet_Frame_Decorator
116 116
     //for proper alignment of bullet image and text. Allow image to not fitting on left border.
117 117
     //This controls the distance between bullet image and text 
118 118
     //return $this->_width;
119 119
     return $this->_frame->get_style()->get_font_size()*List_Bullet_Frame_Decorator::BULLET_SIZE + 
120 120
       2 * List_Bullet_Frame_Decorator::BULLET_PADDING;
121
-  }
121
+    }
122 122
 
123
-  /**
124
-   * Return the bullet's height
125
-   *
126
-   * @return int
127
-   */
128
-  function get_height() {
123
+    /**
124
+     * Return the bullet's height
125
+     *
126
+     * @return int
127
+     */
128
+    function get_height() {
129 129
     //based on image height
130 130
     return $this->_height;
131
-  }
131
+    }
132 132
   
133
-  /**
134
-   * Override get_margin_width
135
-   *
136
-   * @return int
137
-   */
138
-  function get_margin_width() {
133
+    /**
134
+     * Override get_margin_width
135
+     *
136
+     * @return int
137
+     */
138
+    function get_margin_width() {
139 139
     //ignore image width, use same width as on predefined bullet List_Bullet_Frame_Decorator
140 140
     //for proper alignment of bullet image and text. Allow image to not fitting on left border.
141 141
     //This controls the extra indentation of text to make room for the bullet image.
@@ -147,42 +147,42 @@  discard block
 block discarded – undo
147 147
     // Image Might not exist, then position like on list_bullet_frame_decorator fallback to none. 
148 148
     if ( $this->_frame->get_style()->list_style_position === "outside" ||
149 149
          $this->_width == 0) 
150
-      return 0;
150
+        return 0;
151 151
     //This aligns the "inside" image position with the text.
152 152
     //The text starts to the right of the image.
153 153
     //Between the image and the text there is an added margin of image width.
154 154
     //Where this comes from is unknown.
155 155
     //The corresponding List_Bullet_Frame_Decorator sets a smaller margin. bullet size?
156 156
     return $this->_width + 2 * List_Bullet_Frame_Decorator::BULLET_PADDING;
157
-  }
157
+    }
158 158
 
159
-  /**
160
-   * Override get_margin_height()
161
-   *
162
-   * @return int
163
-   */
164
-  function get_margin_height() {
159
+    /**
160
+     * Override get_margin_height()
161
+     *
162
+     * @return int
163
+     */
164
+    function get_margin_height() {
165 165
     //Hits only on "inset" lists items, to increase height of box
166 166
     //based on image height
167 167
     return $this->_height + 2 * List_Bullet_Frame_Decorator::BULLET_PADDING;
168
-  }
168
+    }
169 169
 
170
-  /**
171
-   * Return image url
172
-   *
173
-   * @return string
174
-   */
175
-  function get_image_url() {
170
+    /**
171
+     * Return image url
172
+     *
173
+     * @return string
174
+     */
175
+    function get_image_url() {
176 176
     return $this->_img->get_image_url();
177
-  }
177
+    }
178 178
 
179
-  /**
180
-   * Return the image extension
181
-   *
182
-   * @return string
183
-   */
184
-  function get_image_ext() {
179
+    /**
180
+     * Return the image extension
181
+     *
182
+     * @return string
183
+     */
184
+    function get_image_ext() {
185 185
     return $this->_img->get_image_ext();
186
-  }
186
+    }
187 187
   
188 188
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_factory.cls.php 1 patch
Indentation   +53 added lines, -54 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_factory.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -52,119 +51,119 @@  discard block
 block discarded – undo
52 51
  */
53 52
 class Frame_Factory {
54 53
 
55
-  static function decorate_root(Frame $root, DOMPDF $dompdf) {
54
+    static function decorate_root(Frame $root, DOMPDF $dompdf) {
56 55
     $frame = new Page_Frame_Decorator($root, $dompdf);
57 56
     $frame->set_reflower( new Page_Frame_Reflower($frame) );
58 57
     $root->set_decorator($frame);
59 58
     return $frame;
60
-  }
59
+    }
61 60
 
62
-  // FIXME: this is admittedly a little smelly...
63
-  static function decorate_frame(Frame $frame, $dompdf) {
61
+    // FIXME: this is admittedly a little smelly...
62
+    static function decorate_frame(Frame $frame, $dompdf) {
64 63
     if ( is_null($dompdf) )
65
-      throw new Exception("foo");
64
+        throw new Exception("foo");
66 65
     switch ($frame->get_style()->display) {
67 66
       
68 67
     case "block":
69 68
       $positioner = "Block";        
70
-      $decorator = "Block";
71
-      $reflower = "Block";
72
-      break;
69
+        $decorator = "Block";
70
+        $reflower = "Block";
71
+        break;
73 72
     
74 73
     case "inline-block":
75 74
       $positioner = "Inline";
76
-      $decorator = "Block";
77
-      $reflower = "Block";
78
-      break;
75
+        $decorator = "Block";
76
+        $reflower = "Block";
77
+        break;
79 78
 
80 79
     case "inline":
81 80
       $positioner = "Inline";
82
-      if ( $frame->get_node()->nodeName === "#text" ) {
81
+        if ( $frame->get_node()->nodeName === "#text" ) {
83 82
         $decorator = "Text";
84 83
         $reflower = "Text";
85
-      } else {
84
+        } else {
86 85
         $decorator = "Inline";
87 86
         $reflower = "Inline";
88
-      }
89
-      break;   
87
+        }
88
+        break;   
90 89
 
91 90
     case "table":
92 91
       $positioner = "Block";
93
-      $decorator = "Table";
94
-      $reflower = "Table";
95
-      break;
92
+        $decorator = "Table";
93
+        $reflower = "Table";
94
+        break;
96 95
       
97 96
     case "inline-table":
98 97
       $positioner = "Inline";
99
-      $decorator = "Table";
100
-      $reflower = "Table";
101
-      break;
98
+        $decorator = "Table";
99
+        $reflower = "Table";
100
+        break;
102 101
 
103 102
     case "table-row-group":
104 103
     case "table-header-group":
105 104
     case "table-footer-group":
106 105
       $positioner = "Null";
107
-      $decorator = "Table_Row_Group";
108
-      $reflower = "Table_Row_Group";
109
-      break;
106
+        $decorator = "Table_Row_Group";
107
+        $reflower = "Table_Row_Group";
108
+        break;
110 109
       
111 110
     case "table-row":
112 111
       $positioner = "Null";
113
-      $decorator = "Table_Row";
114
-      $reflower = "Table_Row";
115
-      break;
112
+        $decorator = "Table_Row";
113
+        $reflower = "Table_Row";
114
+        break;
116 115
 
117 116
     case "table-cell":
118 117
       $positioner = "Table_Cell";
119
-      $decorator = "Table_Cell";
120
-      $reflower = "Table_Cell";
121
-      break;
118
+        $decorator = "Table_Cell";
119
+        $reflower = "Table_Cell";
120
+        break;
122 121
         
123 122
     case "list-item":
124 123
       $positioner = "Block";
125
-      $decorator  = "Block";
126
-      $reflower   = "Block";
127
-      break;
124
+        $decorator  = "Block";
125
+        $reflower   = "Block";
126
+        break;
128 127
 
129 128
     case "-dompdf-list-bullet":
130 129
       if ( $frame->get_style()->list_style_position === "inside" )
131 130
         $positioner = "Inline";
132
-      else        
131
+        else        
133 132
         $positioner = "List_Bullet";
134 133
 
135
-      if ( $frame->get_style()->list_style_image !== "none" )
134
+        if ( $frame->get_style()->list_style_image !== "none" )
136 135
         $decorator = "List_Bullet_Image";
137
-      else
136
+        else
138 137
         $decorator = "List_Bullet";
139 138
       
140
-      $reflower = "List_Bullet";
141
-      break;
139
+        $reflower = "List_Bullet";
140
+        break;
142 141
 
143 142
     case "-dompdf-image":
144 143
       $positioner = "Inline";
145
-      $decorator = "Image";
146
-      $reflower = "Image";
147
-      break;
144
+        $decorator = "Image";
145
+        $reflower = "Image";
146
+        break;
148 147
       
149 148
     case "-dompdf-br":
150 149
       $positioner = "Inline";
151
-      $decorator = "Inline";
152
-      $reflower = "Inline";
153
-      break;
150
+        $decorator = "Inline";
151
+        $reflower = "Inline";
152
+        break;
154 153
 
155 154
     default:
156 155
       // FIXME: should throw some sort of warning or something?
157 156
     case "none":
158 157
       $positioner = "Null";
159
-      $decorator = "Null";
160
-      $reflower = "Null";
161
-      break;
158
+        $decorator = "Null";
159
+        $reflower = "Null";
160
+        break;
162 161
 
163 162
     }
164 163
 
165 164
     if ( $frame->get_style()->position === "absolute" ||
166 165
          $frame->get_style()->position === "fixed" )
167
-      $positioner = "Absolute";
166
+        $positioner = "Absolute";
168 167
     
169 168
     $positioner .= "_Positioner";
170 169
     $decorator .= "_Frame_Decorator";
@@ -176,10 +175,10 @@  discard block
 block discarded – undo
176 175
     
177 176
     // Generated content is a special case
178 177
     if ( $frame->get_node()->nodeName === "_dompdf_generated" ) {
179
-      // Decorate the reflower
180
-      $gen = new Generated_Frame_Reflower( $deco );
181
-      $gen->set_reflower( $reflow );
182
-      $reflow = $gen;
178
+        // Decorate the reflower
179
+        $gen = new Generated_Frame_Reflower( $deco );
180
+        $gen->set_reflower( $reflow );
181
+        $reflow = $gen;
183 182
     }
184 183
     
185 184
     $deco->set_reflower( $reflow );
@@ -204,6 +203,6 @@  discard block
 block discarded – undo
204 203
 //     }   
205 204
     
206 205
     return $deco;
207
-  }
206
+    }
208 207
   
209 208
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame_decorator.cls.php 1 patch
Indentation   +181 added lines, -182 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_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,62 +46,62 @@  discard block
 block discarded – undo
47 46
  */
48 47
 abstract class Frame_Decorator extends Frame {
49 48
   
50
-  /**
51
-   * The root node of the DOM tree
52
-   *
53
-   * @var Frame
54
-   */
55
-  protected $_root;
56
-
57
-  /**
58
-   * The decorated frame
59
-   *
60
-   * @var Frame
61
-   */
62
-  protected $_frame;
63
-
64
-  /**
65
-   * Positioner object used to position this frame (Strategy pattern)
66
-   *
67
-   * @var Positioner
68
-   */
69
-  protected $_positioner;
70
-
71
-  /**
72
-   * Reflower object used to calculate frame dimensions (Strategy pattern)
73
-   *
74
-   * @var Frame_Reflower
75
-   */
76
-  protected $_reflower;
49
+    /**
50
+     * The root node of the DOM tree
51
+     *
52
+     * @var Frame
53
+     */
54
+    protected $_root;
55
+
56
+    /**
57
+     * The decorated frame
58
+     *
59
+     * @var Frame
60
+     */
61
+    protected $_frame;
62
+
63
+    /**
64
+     * Positioner object used to position this frame (Strategy pattern)
65
+     *
66
+     * @var Positioner
67
+     */
68
+    protected $_positioner;
69
+
70
+    /**
71
+     * Reflower object used to calculate frame dimensions (Strategy pattern)
72
+     *
73
+     * @var Frame_Reflower
74
+     */
75
+    protected $_reflower;
77 76
   
78
-  /**
79
-   * Reference to the current dompdf instance
80
-   *
81
-   * @var DOMPDF
82
-   */
83
-  protected $_dompdf;
84
-
85
-  /**
86
-   * Class constructor
87
-   *
88
-   * @param Frame $frame the decoration target
89
-   */
90
-  function __construct(Frame $frame, DOMPDF $dompdf) {
77
+    /**
78
+     * Reference to the current dompdf instance
79
+     *
80
+     * @var DOMPDF
81
+     */
82
+    protected $_dompdf;
83
+
84
+    /**
85
+     * Class constructor
86
+     *
87
+     * @param Frame $frame the decoration target
88
+     */
89
+    function __construct(Frame $frame, DOMPDF $dompdf) {
91 90
     $this->_frame = $frame;
92 91
     $this->_root = null;
93 92
     $this->_dompdf = $dompdf;
94 93
     $frame->set_decorator($this);
95
-  }
96
-
97
-  /**
98
-   * "Destructor": foribly free all references held by this object
99
-   *
100
-   * @param bool $recursive if true, call dispose on all children
101
-   */
102
-  function dispose($recursive = false) {
94
+    }
95
+
96
+    /**
97
+     * "Destructor": foribly free all references held by this object
98
+     *
99
+     * @param bool $recursive if true, call dispose on all children
100
+     */
101
+    function dispose($recursive = false) {
103 102
     
104 103
     if ( $recursive ) {
105
-      while ( $child = $this->get_first_child() )
104
+        while ( $child = $this->get_first_child() )
106 105
         $child->dispose(true);
107 106
     }
108 107
     
@@ -112,52 +111,52 @@  discard block
 block discarded – undo
112 111
     unset($this->_positioner);
113 112
     unset($this->_reflower);
114 113
 
115
-  }
114
+    }
116 115
 
117
-  // Return a copy of this frame with $node as its node
118
-  function copy(DomNode $node) {
116
+    // Return a copy of this frame with $node as its node
117
+    function copy(DomNode $node) {
119 118
     $frame = new Frame($node);
120 119
     $frame->set_style(clone $this->_frame->get_original_style());
121 120
     $deco = Frame_Factory::decorate_frame($frame, $this->_dompdf);
122 121
     $deco->set_root($this->_root);
123 122
     return $deco;
124
-  }
125
-
126
-  /**
127
-   * Create a deep copy: copy this node and all children
128
-   *
129
-   * @return Frame
130
-   */
131
-  function deep_copy() {
123
+    }
124
+
125
+    /**
126
+     * Create a deep copy: copy this node and all children
127
+     *
128
+     * @return Frame
129
+     */
130
+    function deep_copy() {
132 131
     $frame = new Frame($this->get_node()->cloneNode());
133 132
     $frame->set_style(clone $this->_frame->get_original_style());
134 133
     $deco = Frame_Factory::decorate_frame($frame, $this->_dompdf);
135 134
     $deco->set_root($this->_root);
136 135
 
137 136
     foreach ($this->get_children() as $child)
138
-      $deco->append_child($child->deep_copy());
137
+        $deco->append_child($child->deep_copy());
139 138
 
140 139
     return $deco;
141
-  }
142
-  //........................................................................
140
+    }
141
+    //........................................................................
143 142
   
144
-  // Delegate calls to decorated frame object
145
-  function reset() {
143
+    // Delegate calls to decorated frame object
144
+    function reset() {
146 145
     $this->_frame->reset();
147 146
 
148 147
     // Reset all children
149 148
     foreach ($this->get_children() as $child)
150
-      $child->reset();
149
+        $child->reset();
151 150
 
152
-  }
151
+    }
153 152
   
154
-  function get_node() { return $this->_frame->get_node(); }
155
-  function get_id() { return $this->_frame->get_id(); }
156
-  function get_style() { return $this->_frame->get_style(); }
157
-  function get_original_style() { return $this->_frame->get_original_style(); }
158
-  function get_containing_block($i = null) { return $this->_frame->get_containing_block($i); }
159
-  function get_position($i = null) { return $this->_frame->get_position($i); }
160
-  function get_dompdf() { return $this->_dompdf; }
153
+    function get_node() { return $this->_frame->get_node(); }
154
+    function get_id() { return $this->_frame->get_id(); }
155
+    function get_style() { return $this->_frame->get_style(); }
156
+    function get_original_style() { return $this->_frame->get_original_style(); }
157
+    function get_containing_block($i = null) { return $this->_frame->get_containing_block($i); }
158
+    function get_position($i = null) { return $this->_frame->get_position($i); }
159
+    function get_dompdf() { return $this->_dompdf; }
161 160
 //   function get_decorator() {
162 161
 //     if ( isset($this->_decorator) )
163 162
 //       return $this->_decorator;
@@ -165,201 +164,201 @@  discard block
 block discarded – undo
165 164
 //       return $this;
166 165
 //   }
167 166
 
168
-  function get_margin_height() { return $this->_frame->get_margin_height(); }
169
-  function get_margin_width() { return $this->_frame->get_margin_width(); }
170
-  function get_padding_box() { return $this->_frame->get_padding_box(); }
171
-  function get_border_box() { return $this->_frame->get_border_box(); }
167
+    function get_margin_height() { return $this->_frame->get_margin_height(); }
168
+    function get_margin_width() { return $this->_frame->get_margin_width(); }
169
+    function get_padding_box() { return $this->_frame->get_padding_box(); }
170
+    function get_border_box() { return $this->_frame->get_border_box(); }
172 171
 
173
-  function set_id($id) { $this->_frame->set_id($id); }
174
-  function set_style(Style $style) { $this->_frame->set_style($style); }
172
+    function set_id($id) { $this->_frame->set_id($id); }
173
+    function set_style(Style $style) { $this->_frame->set_style($style); }
175 174
 
176
-  function set_containing_block($x = null, $y = null, $w = null, $h = null) {
175
+    function set_containing_block($x = null, $y = null, $w = null, $h = null) {
177 176
     $this->_frame->set_containing_block($x, $y, $w, $h);
178
-  }
177
+    }
179 178
 
180
-  function set_position($x = null, $y = null) {
179
+    function set_position($x = null, $y = null) {
181 180
     $this->_frame->set_position($x, $y);
182
-  }
183
-  function __toString() { return $this->_frame->__toString(); }
181
+    }
182
+    function __toString() { return $this->_frame->__toString(); }
184 183
   
185
-  function prepend_child(Frame $child, $update_node = true) {
184
+    function prepend_child(Frame $child, $update_node = true) {
186 185
     while ( $child instanceof Frame_Decorator )
187
-      $child = $child->_frame;
186
+        $child = $child->_frame;
188 187
     
189 188
     $this->_frame->prepend_child($child, $update_node);
190
-  }
189
+    }
191 190
 
192
-  function append_child(Frame $child, $update_node = true) {
191
+    function append_child(Frame $child, $update_node = true) {
193 192
     while ( $child instanceof Frame_Decorator )
194
-      $child = $child->_frame;
193
+        $child = $child->_frame;
195 194
 
196 195
     $this->_frame->append_child($child, $update_node);
197
-  }
196
+    }
198 197
 
199
-  function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
198
+    function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
200 199
     while ( $new_child instanceof Frame_Decorator )
201
-      $new_child = $new_child->_frame;
200
+        $new_child = $new_child->_frame;
202 201
 
203 202
     if ( $ref instanceof Frame_Decorator )
204
-      $ref = $ref->_frame;
203
+        $ref = $ref->_frame;
205 204
 
206 205
     $this->_frame->insert_child_before($new_child, $ref, $update_node);
207
-  }
206
+    }
208 207
 
209
-  function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {
208
+    function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {
210 209
     while ( $new_child instanceof Frame_Decorator )
211
-      $new_child = $new_child->_frame;
210
+        $new_child = $new_child->_frame;
212 211
 
213 212
     while ( $ref instanceof Frame_Decorator )
214
-      $ref = $ref->_frame;
213
+        $ref = $ref->_frame;
215 214
     
216 215
     $this->_frame->insert_child_after($new_child, $ref, $update_node);
217
-  }
216
+    }
218 217
 
219
-  function remove_child(Frame $child, $update_node = true) {
218
+    function remove_child(Frame $child, $update_node = true) {
220 219
     while  ( $child instanceof Frame_Decorator )
221
-      $child = $new_child->_frame;
220
+        $child = $new_child->_frame;
222 221
 
223 222
     $this->_frame->remove_child($child, $update_node);
224
-  }
223
+    }
225 224
   
226
-  //........................................................................
225
+    //........................................................................
227 226
 
228
-  function get_parent() {
227
+    function get_parent() {
229 228
 
230 229
     $p = $this->_frame->get_parent();
231 230
     
232 231
     if ( $p && $deco = $p->get_decorator() ) {
233
-      while ( $tmp = $deco->get_decorator() )
232
+        while ( $tmp = $deco->get_decorator() )
234 233
         $deco = $tmp;      
235
-      return $deco;
234
+        return $deco;
236 235
     } else if ( $p )
237
-      return $p;
236
+        return $p;
238 237
     else
239
-      return null;
240
-  }
238
+        return null;
239
+    }
241 240
 
242
-  function get_first_child() {
241
+    function get_first_child() {
243 242
     $c = $this->_frame->get_first_child();
244 243
     if ( $c && $deco = $c->get_decorator() ) {
245
-      while ( $tmp = $deco->get_decorator() )
244
+        while ( $tmp = $deco->get_decorator() )
246 245
         $deco = $tmp;      
247
-      return $deco;
246
+        return $deco;
248 247
     } else if ( $c )
249
-      return $c;
248
+        return $c;
250 249
     else
251
-      return null;
252
-  }
250
+        return null;
251
+    }
253 252
 
254
-  function get_last_child() {
253
+    function get_last_child() {
255 254
     $c = $this->_frame->get_last_child();
256 255
     if ( $c && $deco = $c->get_decorator() ) {
257
-      while ( $tmp = $deco->get_decorator() )
256
+        while ( $tmp = $deco->get_decorator() )
258 257
         $deco = $tmp;      
259
-      return $deco;
258
+        return $deco;
260 259
     } else if ( $c )
261
-      return $c;
260
+        return $c;
262 261
     else
263
-      return null;
264
-  }
262
+        return null;
263
+    }
265 264
 
266
-  function get_prev_sibling() {
265
+    function get_prev_sibling() {
267 266
     $s = $this->_frame->get_prev_sibling();
268 267
     if ( $s && $deco = $s->get_decorator() ) {
269
-      while ( $tmp = $deco->get_decorator() )
268
+        while ( $tmp = $deco->get_decorator() )
270 269
         $deco = $tmp;      
271
-      return $deco;
270
+        return $deco;
272 271
     } else if ( $s )
273
-      return $s;
272
+        return $s;
274 273
     else
275
-      return null;
276
-  }
274
+        return null;
275
+    }
277 276
   
278
-  function get_next_sibling() {
277
+    function get_next_sibling() {
279 278
     $s = $this->_frame->get_next_sibling();
280 279
     if ( $s && $deco = $s->get_decorator() ) {
281
-      while ( $tmp = $deco->get_decorator() )
280
+        while ( $tmp = $deco->get_decorator() )
282 281
         $deco = $tmp;      
283
-      return $deco;
282
+        return $deco;
284 283
     } else if ( $s )
285
-      return $s;
284
+        return $s;
286 285
     else
287
-      return null;
288
-  }
286
+        return null;
287
+    }
289 288
 
290
-  function get_children() {
289
+    function get_children() {
291 290
     return new FrameList($this);
292
-  }
291
+    }
293 292
 
294
-  function get_subtree() {
293
+    function get_subtree() {
295 294
     return new FrameTreeList($this);
296
-  }
295
+    }
297 296
   
298
-  //........................................................................
297
+    //........................................................................
299 298
 
300
-  function set_positioner(Positioner $posn) {
299
+    function set_positioner(Positioner $posn) {
301 300
     $this->_positioner = $posn;
302 301
     if ( $this->_frame instanceof Frame_Decorator )
303
-      $this->_frame->set_positioner($posn);
304
-  }
302
+        $this->_frame->set_positioner($posn);
303
+    }
305 304
   
306
-  //........................................................................
305
+    //........................................................................
307 306
 
308
-  function set_reflower(Frame_Reflower $reflower) {
307
+    function set_reflower(Frame_Reflower $reflower) {
309 308
     $this->_reflower = $reflower;
310 309
     if ( $this->_frame instanceof Frame_Decorator )
311
-      $this->_frame->set_reflower( $reflower );
312
-  }
310
+        $this->_frame->set_reflower( $reflower );
311
+    }
313 312
   
314
-  function get_reflower() { return $this->_reflower; }
313
+    function get_reflower() { return $this->_reflower; }
315 314
   
316
-  //........................................................................
315
+    //........................................................................
317 316
   
318
-  function set_root(Frame $root) {
317
+    function set_root(Frame $root) {
319 318
     $this->_root = $root;
320
-      if ( $this->_frame instanceof Frame_Decorator )
319
+        if ( $this->_frame instanceof Frame_Decorator )
321 320
         $this->_frame->set_root($root);
322
-  }
321
+    }
323 322
   
324
-  function get_root() { return $this->_root; }
323
+    function get_root() { return $this->_root; }
325 324
   
326
-  //........................................................................
325
+    //........................................................................
327 326
 
328
-  function find_block_parent() {
327
+    function find_block_parent() {
329 328
 
330 329
     // Find our nearest block level parent
331 330
     $p = $this->get_parent();
332 331
     
333 332
     while ( $p ) {
334
-      if ( in_array($p->get_style()->display, Style::$BLOCK_TYPES) )
333
+        if ( in_array($p->get_style()->display, Style::$BLOCK_TYPES) )
335 334
         break;
336 335
 
337
-      $p = $p->get_parent();
336
+        $p = $p->get_parent();
338 337
     }
339 338
 
340 339
     return $p;
341
-  }
340
+    }
342 341
 
343
-  //........................................................................
342
+    //........................................................................
344 343
 
345
-  /**
346
-   * split this frame at $child.
347
-   *
348
-   * The current frame is cloned and $child and all children following
349
-   * $child are added to the clone.  The clone is then passed to the
350
-   * current frame's parent->split() method.
351
-   *
352
-   * @param Frame $child
353
-   */
354
-  function split($child = null) {
344
+    /**
345
+     * split this frame at $child.
346
+     *
347
+     * The current frame is cloned and $child and all children following
348
+     * $child are added to the clone.  The clone is then passed to the
349
+     * current frame's parent->split() method.
350
+     *
351
+     * @param Frame $child
352
+     */
353
+    function split($child = null) {
355 354
 
356 355
     if ( is_null( $child ) ) {
357
-      $this->get_parent()->split($this);
358
-      return;
356
+        $this->get_parent()->split($this);
357
+        return;
359 358
     }
360 359
     
361 360
     if ( $child->get_parent() !== $this )
362
-      throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
361
+        throw new DOMPDF_Exception("Unable to split: frame is not a child of this one.");
363 362
 
364 363
     $split = $this->copy( $this->_frame->get_node()->cloneNode() );
365 364
     $split->reset();
@@ -368,29 +367,29 @@  discard block
 block discarded – undo
368 367
     // Add $frame and all following siblings to the new split node
369 368
     $iter = $child;
370 369
     while ($iter) {
371
-      $frame = $iter;      
372
-      $iter = $iter->get_next_sibling();
373
-      $frame->reset();
374
-      $split->append_child($frame);
370
+        $frame = $iter;      
371
+        $iter = $iter->get_next_sibling();
372
+        $frame->reset();
373
+        $split->append_child($frame);
375 374
     }
376 375
 
377 376
     $this->get_parent()->split($split);
378
-  }
377
+    }
379 378
 
380
-  //........................................................................
379
+    //........................................................................
381 380
 
382
-  final function position() { $this->_positioner->position();  }
381
+    final function position() { $this->_positioner->position();  }
383 382
   
384
-  final function reflow() {
383
+    final function reflow() {
385 384
     // Uncomment this to see the frames before they're laid out, instead of
386 385
     // during rendering.
387 386
     //echo $this->_frame; flush();
388 387
     $this->_reflower->reflow();
389
-  }
388
+    }
390 389
 
391
-  final function get_min_max_width() { return $this->get_reflower()->get_min_max_width(); }
390
+    final function get_min_max_width() { return $this->get_reflower()->get_min_max_width(); }
392 391
   
393
-  //........................................................................
392
+    //........................................................................
394 393
 
395 394
 
396 395
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/list_bullet_renderer.cls.php 1 patch
Indentation   +24 added lines, -25 removed lines patch added patch discarded remove patch
@@ -35,7 +35,6 @@  discard block
 block discarded – undo
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @contributor Helmut Tischer <[email protected]>
37 37
  * @package dompdf
38
-
39 38
  *
40 39
  * Changes
41 40
  * @contributor Helmut Tischer <[email protected]>
@@ -53,9 +52,9 @@  discard block
 block discarded – undo
53 52
  */
54 53
 class List_Bullet_Renderer extends Abstract_Renderer {
55 54
 
56
-  //........................................................................
55
+    //........................................................................
57 56
 
58
-  function render(Frame $frame) {
57
+    function render(Frame $frame) {
59 58
 
60 59
     $style = $frame->get_style();
61 60
     $font_size = $style->get_font_size();
@@ -66,36 +65,36 @@  discard block
 block discarded – undo
66 65
     if ( $style->list_style_image !== "none" &&
67 66
          strcmp($img = $frame->get_image_url(), DOMPDF_LIB_DIR . "/res/broken_image.png") != 0) {
68 67
 
69
-      list($x,$y) = $frame->get_position();
68
+        list($x,$y) = $frame->get_position();
70 69
       
71
-      //For expected size and aspect, instead of box size, use image natural size scaled to DPI.
72
-      // Resample the bullet image to be consistent with 'auto' sized images
73
-      // See also Image_Frame_Reflower::get_min_max_width
74
-      // Tested php ver: value measured in px, suffix "px" not in value: rtrim unnecessary.
75
-      //$w = $frame->get_width();
76
-      //$h = $frame->get_height();
77
-      list($width, $height) = getimagesize($img);
78
-      $w = (((float)rtrim($width, "px")) * 72) / DOMPDF_DPI;
79
-      $h = (((float)rtrim($height, "px")) * 72) / DOMPDF_DPI;
70
+        //For expected size and aspect, instead of box size, use image natural size scaled to DPI.
71
+        // Resample the bullet image to be consistent with 'auto' sized images
72
+        // See also Image_Frame_Reflower::get_min_max_width
73
+        // Tested php ver: value measured in px, suffix "px" not in value: rtrim unnecessary.
74
+        //$w = $frame->get_width();
75
+        //$h = $frame->get_height();
76
+        list($width, $height) = getimagesize($img);
77
+        $w = (((float)rtrim($width, "px")) * 72) / DOMPDF_DPI;
78
+        $h = (((float)rtrim($height, "px")) * 72) / DOMPDF_DPI;
80 79
       
81
-      $x -= $w;
82
-      $y -= ($line_height - $font_size)/2; //Reverse hinting of list_bullet_positioner
80
+        $x -= $w;
81
+        $y -= ($line_height - $font_size)/2; //Reverse hinting of list_bullet_positioner
83 82
 
84
-      $this->_canvas->image( $img, $frame->get_image_ext(), $x, $y, $w, $h);
83
+        $this->_canvas->image( $img, $frame->get_image_ext(), $x, $y, $w, $h);
85 84
 
86 85
     } else {
87 86
 
88
-      $bullet_style = $style->list_style_type;
87
+        $bullet_style = $style->list_style_type;
89 88
 
90
-      $fill = false;
89
+        $fill = false;
91 90
 
92
-      switch ($bullet_style) {
91
+        switch ($bullet_style) {
93 92
 
94
-      default:
93
+        default:
95 94
       case "disc":
96 95
         $fill = true;
97 96
 
98
-      case "circle":
97
+        case "circle":
99 98
         list($x,$y) = $frame->get_position();
100 99
         $r = ($font_size*(List_Bullet_Frame_Decorator::BULLET_SIZE /*-List_Bullet_Frame_Decorator::BULLET_THICKNESS*/ ))/2;
101 100
         $x -= $font_size*(List_Bullet_Frame_Decorator::BULLET_SIZE/2);
@@ -104,7 +103,7 @@  discard block
 block discarded – undo
104 103
         $this->_canvas->circle($x, $y, $r, $style->color, $o, null, $fill);
105 104
         break;
106 105
 
107
-      case "square":
106
+        case "square":
108 107
         list($x, $y) = $frame->get_position();
109 108
         $w = $font_size*List_Bullet_Frame_Decorator::BULLET_SIZE;
110 109
         $x -= $w;
@@ -112,10 +111,10 @@  discard block
 block discarded – undo
112 111
         $this->_canvas->filled_rectangle($x, $y, $w, $w, $style->color);
113 112
         break;
114 113
       
115
-      case "none":
114
+        case "none":
116 115
         break;
117 116
 
118
-      }
117
+        }
118
+    }
119 119
     }
120
-  }
121 120
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/pdflib_adapter.cls.php 1 patch
Indentation   +527 added lines, -527 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: pdflib_adapter.cls.php,v $
6
- * Created on: 2005-02-28
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @contributor Helmut Tischer <[email protected]>
37
- * @package dompdf
38
- *
39
- * Changes
40
- * @contributor Helmut Tischer <[email protected]>
41
- * @version 0.5.1.htischer.20090507
42
- * - Clarify temp file name, optional debug output for temp file tracking
43
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: pdflib_adapter.cls.php,v $
6
+     * Created on: 2005-02-28
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @contributor Helmut Tischer <[email protected]>
37
+     * @package dompdf
38
+     *
39
+     * Changes
40
+     * @contributor Helmut Tischer <[email protected]>
41
+     * @version 0.5.1.htischer.20090507
42
+     * - Clarify temp file name, optional debug output for temp file tracking
43
+     */
44 44
 
45 45
 /* $Id: pdflib_adapter.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */
46 46
 
@@ -61,170 +61,170 @@  discard block
 block discarded – undo
61 61
  */
62 62
 class PDFLib_Adapter implements Canvas {
63 63
 
64
-  /**
65
-   * Dimensions of paper sizes in points
66
-   *
67
-   * @var array;
68
-   */
69
-  static public $PAPER_SIZES = array(); // Set to
64
+    /**
65
+     * Dimensions of paper sizes in points
66
+     *
67
+     * @var array;
68
+     */
69
+    static public $PAPER_SIZES = array(); // Set to
70 70
                                         // CPDF_Adapter::$PAPER_SIZES below.
71 71
 
72
-  /**
73
-   * Fudge factor to adjust reported font heights
74
-   *
75
-   * CPDF reports larger font heights than PDFLib.  This factor
76
-   * adjusts the height reported by get_font_height().
77
-   *
78
-   * @var float
79
-   */
80
-  const FONT_HEIGHT_SCALE = 1.2;
81
-
82
-  /**
83
-   * Whether to create PDFs in memory or on disk
84
-   *
85
-   * @var bool
86
-   */
87
-  static $IN_MEMORY = true;
88
-
89
-  /**
90
-   * Instance of PDFLib class
91
-   *
92
-   * @var PDFlib
93
-   */
94
-  private $_pdf;
95
-
96
-  /**
97
-   * Name of temporary file used for PDFs created on disk
98
-   *
99
-   * @var string
100
-   */
101
-  private $_file;
102
-
103
-  /**
104
-   * PDF width, in points
105
-   *
106
-   * @var float
107
-   */
108
-  private $_width;
109
-
110
-  /**
111
-   * PDF height, in points
112
-   *
113
-   * @var height
114
-   */
115
-  private $_height;
116
-
117
-  /**
118
-   * Last fill colour used
119
-   *
120
-   * @var array
121
-   */
122
-  private $_last_fill_color;
123
-
124
-  /**
125
-   * Last stroke colour used
126
-   *
127
-   * @var array
128
-   */
129
-  private $_last_stroke_color;
130
-
131
-  /**
132
-   * Cache of image handles
133
-   *
134
-   * @var array
135
-   */
136
-  private $_imgs;
137
-
138
-  /**
139
-   * Cache of font handles
140
-   *
141
-   * @var array
142
-   */
143
-  private $_fonts;
144
-
145
-  /**
146
-   * List of objects (templates) to add to multiple pages
147
-   *
148
-   * @var array
149
-   */
150
-  private $_objs;
151
-
152
-  /**
153
-   * Current page number
154
-   *
155
-   * @var int
156
-   */
157
-  private $_page_number;
158
-
159
-  /**
160
-   * Total number of pages
161
-   *
162
-   * @var int
163
-   */
164
-  private $_page_count;
165
-
166
-  /**
167
-   * Text to display on every page
168
-   *
169
-   * @var array
170
-   */
171
-  private $_page_text;
172
-
173
-  /**
174
-   * Array of pages for accesing after rendering is initially complete
175
-   *
176
-   * @var array
177
-   */
178
-  private $_pages;
179
-
180
-  /**
181
-   * Class constructor
182
-   *
183
-   * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
184
-   *                     an array(xmin,ymin,xmax,ymax)
185
-   * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
186
-   */
187
-  function __construct($paper = "letter", $orientation = "portrait") {
72
+    /**
73
+     * Fudge factor to adjust reported font heights
74
+     *
75
+     * CPDF reports larger font heights than PDFLib.  This factor
76
+     * adjusts the height reported by get_font_height().
77
+     *
78
+     * @var float
79
+     */
80
+    const FONT_HEIGHT_SCALE = 1.2;
81
+
82
+    /**
83
+     * Whether to create PDFs in memory or on disk
84
+     *
85
+     * @var bool
86
+     */
87
+    static $IN_MEMORY = true;
88
+
89
+    /**
90
+     * Instance of PDFLib class
91
+     *
92
+     * @var PDFlib
93
+     */
94
+    private $_pdf;
95
+
96
+    /**
97
+     * Name of temporary file used for PDFs created on disk
98
+     *
99
+     * @var string
100
+     */
101
+    private $_file;
102
+
103
+    /**
104
+     * PDF width, in points
105
+     *
106
+     * @var float
107
+     */
108
+    private $_width;
109
+
110
+    /**
111
+     * PDF height, in points
112
+     *
113
+     * @var height
114
+     */
115
+    private $_height;
116
+
117
+    /**
118
+     * Last fill colour used
119
+     *
120
+     * @var array
121
+     */
122
+    private $_last_fill_color;
123
+
124
+    /**
125
+     * Last stroke colour used
126
+     *
127
+     * @var array
128
+     */
129
+    private $_last_stroke_color;
130
+
131
+    /**
132
+     * Cache of image handles
133
+     *
134
+     * @var array
135
+     */
136
+    private $_imgs;
137
+
138
+    /**
139
+     * Cache of font handles
140
+     *
141
+     * @var array
142
+     */
143
+    private $_fonts;
144
+
145
+    /**
146
+     * List of objects (templates) to add to multiple pages
147
+     *
148
+     * @var array
149
+     */
150
+    private $_objs;
151
+
152
+    /**
153
+     * Current page number
154
+     *
155
+     * @var int
156
+     */
157
+    private $_page_number;
158
+
159
+    /**
160
+     * Total number of pages
161
+     *
162
+     * @var int
163
+     */
164
+    private $_page_count;
165
+
166
+    /**
167
+     * Text to display on every page
168
+     *
169
+     * @var array
170
+     */
171
+    private $_page_text;
172
+
173
+    /**
174
+     * Array of pages for accesing after rendering is initially complete
175
+     *
176
+     * @var array
177
+     */
178
+    private $_pages;
179
+
180
+    /**
181
+     * Class constructor
182
+     *
183
+     * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
184
+     *                     an array(xmin,ymin,xmax,ymax)
185
+     * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
186
+     */
187
+    function __construct($paper = "letter", $orientation = "portrait") {
188 188
     if ( is_array($paper) )
189
-      $size = $paper;
189
+        $size = $paper;
190 190
     else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) )
191
-      $size = self::$PAPER_SIZES[mb_strtolower($paper)];
191
+        $size = self::$PAPER_SIZES[mb_strtolower($paper)];
192 192
     else
193
-      $size = self::$PAPER_SIZES["letter"];
193
+        $size = self::$PAPER_SIZES["letter"];
194 194
 
195 195
     if ( mb_strtolower($orientation) === "landscape" ) {
196
-      $a = $size[3];
197
-      $size[3] = $size[2];
198
-      $size[2] = $a;
196
+        $a = $size[3];
197
+        $size[3] = $size[2];
198
+        $size[2] = $a;
199 199
     }
200 200
     $this->_width = $size[2] - $size[0];
201 201
     $this->_height= $size[3] - $size[1];
202 202
 
203 203
     $this->_pdf = new PDFLib();
204 204
 
205
-	if ( defined("DOMPDF_PDFLIB_LICENSE") )
206
-      $this->_pdf->set_parameter( "license", DOMPDF_PDFLIB_LICENSE);
205
+    if ( defined("DOMPDF_PDFLIB_LICENSE") )
206
+        $this->_pdf->set_parameter( "license", DOMPDF_PDFLIB_LICENSE);
207 207
 
208
-	$this->_pdf->set_parameter("textformat", "utf8");
208
+    $this->_pdf->set_parameter("textformat", "utf8");
209 209
     $this->_pdf->set_parameter("fontwarning", "false");
210 210
 
211 211
     $this->_pdf->set_info("Creator", "DOMPDF Converter");
212 212
 
213 213
     // Silence pedantic warnings about missing TZ settings
214 214
     if ( function_exists("date_default_timezone_get") ) {
215
-      $tz = @date_default_timezone_get();
216
-      date_default_timezone_set("UTC");
217
-      $this->_pdf->set_info("Date", date("Y-m-d"));
218
-      date_default_timezone_set($tz);
215
+        $tz = @date_default_timezone_get();
216
+        date_default_timezone_set("UTC");
217
+        $this->_pdf->set_info("Date", date("Y-m-d"));
218
+        date_default_timezone_set($tz);
219 219
     } else {
220
-      $this->_pdf->set_info("Date", date("Y-m-d"));
220
+        $this->_pdf->set_info("Date", date("Y-m-d"));
221 221
     }
222 222
 
223 223
     if ( self::$IN_MEMORY )
224
-      $this->_pdf->begin_document("","");
224
+        $this->_pdf->begin_document("","");
225 225
     else {
226
-      $this->_file = tempnam(DOMPDF_TEMP_DIR, "libdompdf_pdf_").'.pdf';
227
-      $this->_pdf->begin_document($this->_file,"");
226
+        $this->_file = tempnam(DOMPDF_TEMP_DIR, "libdompdf_pdf_").'.pdf';
227
+        $this->_pdf->begin_document($this->_file,"");
228 228
     }
229 229
 
230 230
     $this->_pdf->begin_page_ext($this->_width, $this->_height, "");
@@ -239,155 +239,155 @@  discard block
 block discarded – undo
239 239
     // Set up font paths
240 240
     $families = Font_Metrics::get_font_families();
241 241
     foreach ($families as $family => $files) {
242
-      foreach ($files as $style => $file) {
242
+        foreach ($files as $style => $file) {
243 243
         $face = basename($file);
244 244
 
245 245
         // Prefer ttfs to afms
246 246
         if ( file_exists($file.".ttf") ) {
247
-          $outline = "$file.ttf";
248
-          $afm = null;
247
+            $outline = "$file.ttf";
248
+            $afm = null;
249 249
 
250 250
         } else if ( file_exists($file .".TTF") ) {
251
-          $outline = "$file.TTF";
252
-          $afm = null;
251
+            $outline = "$file.TTF";
252
+            $afm = null;
253 253
 
254 254
         } else if ( file_exists($file . ".pfb") ) {
255
-          $outline = "$file.pfb";
255
+            $outline = "$file.pfb";
256 256
 
257
-          if ( file_exists($file . ".afm") )
257
+            if ( file_exists($file . ".afm") )
258 258
             $afm = "$file.afm";
259 259
 
260 260
         } else if ( file_exists($file . ".PFB") ) {
261
-          $outline = "$file.PFB";
262
-          if ( file_exists($file . ".AFM") )
261
+            $outline = "$file.PFB";
262
+            if ( file_exists($file . ".AFM") )
263 263
             $afm = "$file.AFM";
264 264
         } else
265
-          continue;
265
+            continue;
266 266
 
267 267
         $this->_pdf->set_parameter("FontOutline", "\{$face\}=\{$outline\}");
268 268
         if ( !is_null($afm) )
269
-          $this->_pdf->set_parameter("FontAFM", "\{$face\}=\{$afm\}");
270
-      }
269
+            $this->_pdf->set_parameter("FontAFM", "\{$face\}=\{$afm\}");
270
+        }
271
+    }
271 272
     }
272
-  }
273 273
 
274
-  /**
275
-   * Close the pdf
276
-   */
277
-  protected function _close() {
274
+    /**
275
+     * Close the pdf
276
+     */
277
+    protected function _close() {
278 278
     $this->_place_objects();
279 279
 
280 280
     // Close all pages
281 281
     $this->_pdf->suspend_page("");
282 282
     for ($p = 1; $p <= $this->_page_count; $p++) {
283
-      $this->_pdf->resume_page("pagenumber=$p");
284
-      $this->_pdf->end_page_ext("");
283
+        $this->_pdf->resume_page("pagenumber=$p");
284
+        $this->_pdf->end_page_ext("");
285 285
     }
286 286
 
287 287
     $this->_pdf->end_document("");
288
-  }
289
-
290
-
291
-  /**
292
-   * Returns the PDFLib instance
293
-   *
294
-   * @return PDFLib
295
-   */
296
-  function get_pdflib() { return $this->_pdf; }
297
-
298
-  /**
299
-   * Add meta information to the PDF
300
-   *
301
-   * @param string $label  label of the value (Creator, Producter, etc.)
302
-   * @param string $value  the text to set
303
-   */
304
-  function add_info($label, $value) {
288
+    }
289
+
290
+
291
+    /**
292
+     * Returns the PDFLib instance
293
+     *
294
+     * @return PDFLib
295
+     */
296
+    function get_pdflib() { return $this->_pdf; }
297
+
298
+    /**
299
+     * Add meta information to the PDF
300
+     *
301
+     * @param string $label  label of the value (Creator, Producter, etc.)
302
+     * @param string $value  the text to set
303
+     */
304
+    function add_info($label, $value) {
305 305
     $this->_pdf->set_info($label, $value);
306
-  }
306
+    }
307 307
   
308
-  /**
309
-   * Opens a new 'object' (template in PDFLib-speak)
310
-   *
311
-   * While an object is open, all drawing actions are recorded to the
312
-   * object instead of being drawn on the current page.  Objects can
313
-   * be added later to a specific page or to several pages.
314
-   *
315
-   * The return value is an integer ID for the new object.
316
-   *
317
-   * @see PDFLib_Adapter::close_object()
318
-   * @see PDFLib_Adapter::add_object()
319
-   *
320
-   * @return int
321
-   */
322
-  function open_object() {
308
+    /**
309
+     * Opens a new 'object' (template in PDFLib-speak)
310
+     *
311
+     * While an object is open, all drawing actions are recorded to the
312
+     * object instead of being drawn on the current page.  Objects can
313
+     * be added later to a specific page or to several pages.
314
+     *
315
+     * The return value is an integer ID for the new object.
316
+     *
317
+     * @see PDFLib_Adapter::close_object()
318
+     * @see PDFLib_Adapter::add_object()
319
+     *
320
+     * @return int
321
+     */
322
+    function open_object() {
323 323
     $this->_pdf->suspend_page("");
324 324
     $ret = $this->_pdf->begin_template($this->_width, $this->_height);
325 325
     $this->_pdf->save();
326 326
     $this->_objs[$ret] = array("start_page" => $this->_page_number);
327 327
     return $ret;
328
-  }
329
-
330
-  /**
331
-   * Reopen an existing object (NOT IMPLEMENTED)
332
-   *
333
-   * PDFLib does not seem to support reopening templates.
334
-   *
335
-   * @param int $object the ID of a previously opened object
336
-   */
337
-  function reopen_object($object) {
328
+    }
329
+
330
+    /**
331
+     * Reopen an existing object (NOT IMPLEMENTED)
332
+     *
333
+     * PDFLib does not seem to support reopening templates.
334
+     *
335
+     * @param int $object the ID of a previously opened object
336
+     */
337
+    function reopen_object($object) {
338 338
     throw new DOMPDF_Exception("PDFLib does not support reopening objects.");
339
-  }
340
-
341
-  /**
342
-   * Close the current template
343
-   *
344
-   * @see PDFLib_Adapter::open_object()
345
-   */
346
-  function close_object() {
339
+    }
340
+
341
+    /**
342
+     * Close the current template
343
+     *
344
+     * @see PDFLib_Adapter::open_object()
345
+     */
346
+    function close_object() {
347 347
     $this->_pdf->restore();
348 348
     $this->_pdf->end_template();
349 349
     $this->_pdf->resume_page("pagenumber=".$this->_page_number);
350
-  }
351
-
352
-  /**
353
-   * Adds the specified object to the document
354
-   *
355
-   * $where can be one of:
356
-   * - 'add' add to current page only
357
-   * - 'all' add to every page from the current one onwards
358
-   * - 'odd' add to all odd numbered pages from now on
359
-   * - 'even' add to all even numbered pages from now on
360
-   * - 'next' add the object to the next page only
361
-   * - 'nextodd' add to all odd numbered pages from the next one
362
-   * - 'nexteven' add to all even numbered pages from the next one
363
-   *
364
-   * @param int $object the object handle returned by open_object()
365
-   * @param string $where
366
-   */
367
-  function add_object($object, $where = 'all') {
350
+    }
351
+
352
+    /**
353
+     * Adds the specified object to the document
354
+     *
355
+     * $where can be one of:
356
+     * - 'add' add to current page only
357
+     * - 'all' add to every page from the current one onwards
358
+     * - 'odd' add to all odd numbered pages from now on
359
+     * - 'even' add to all even numbered pages from now on
360
+     * - 'next' add the object to the next page only
361
+     * - 'nextodd' add to all odd numbered pages from the next one
362
+     * - 'nexteven' add to all even numbered pages from the next one
363
+     *
364
+     * @param int $object the object handle returned by open_object()
365
+     * @param string $where
366
+     */
367
+    function add_object($object, $where = 'all') {
368 368
 
369 369
     if ( mb_strpos($where, "next") !== false ) {
370
-      $this->_objs[$object]["start_page"]++;
371
-      $where = str_replace("next", "", $where);
372
-      if ( $where == "" )
370
+        $this->_objs[$object]["start_page"]++;
371
+        $where = str_replace("next", "", $where);
372
+        if ( $where == "" )
373 373
         $where = "add";
374 374
     }
375 375
 
376 376
     $this->_objs[$object]["where"] = $where;
377
-  }
378
-
379
-  /**
380
-   * Stops the specified template from appearing in the document.
381
-   *
382
-   * The object will stop being displayed on the page following the
383
-   * current one.
384
-   *
385
-   * @param int $object
386
-   */
387
-  function stop_object($object) {
377
+    }
378
+
379
+    /**
380
+     * Stops the specified template from appearing in the document.
381
+     *
382
+     * The object will stop being displayed on the page following the
383
+     * current one.
384
+     *
385
+     * @param int $object
386
+     */
387
+    function stop_object($object) {
388 388
 
389 389
     if ( !isset($this->_objs[$object]) )
390
-      return;
390
+        return;
391 391
 
392 392
     $start = $this->_objs[$object]["start_page"];
393 393
     $where = $this->_objs[$object]["where"];
@@ -397,74 +397,74 @@  discard block
 block discarded – undo
397 397
          (($this->_page_number % 2 == 0 && $where === "even") ||
398 398
           ($this->_page_number % 2 == 1 && $where === "odd") ||
399 399
           ($where === "all")) )
400
-      $this->_pdf->fit_image($object,0,0,"");
400
+        $this->_pdf->fit_image($object,0,0,"");
401 401
 
402 402
     unset($this->_objs[$object]);
403
-  }
403
+    }
404 404
 
405
-  /**
406
-   * Add all active objects to the current page
407
-   */
408
-  protected function _place_objects() {
405
+    /**
406
+     * Add all active objects to the current page
407
+     */
408
+    protected function _place_objects() {
409 409
 
410 410
     foreach ( $this->_objs as $obj => $props ) {
411
-      $start = $props["start_page"];
412
-      $where = $props["where"];
411
+        $start = $props["start_page"];
412
+        $where = $props["where"];
413 413
 
414
-      // Place the object on this page if required
415
-      if ( $this->_page_number >= $start &&
414
+        // Place the object on this page if required
415
+        if ( $this->_page_number >= $start &&
416 416
            (($this->_page_number % 2 == 0 && $where === "even") ||
417 417
             ($this->_page_number % 2 == 1 && $where === "odd") ||
418 418
             ($where === "all")) ) {
419 419
         $this->_pdf->fit_image($obj,0,0,"");
420
-      }
420
+        }
421 421
     }
422 422
 
423
-  }
423
+    }
424 424
 
425
-  function get_width() { return $this->_width; }
425
+    function get_width() { return $this->_width; }
426 426
 
427
-  function get_height() { return $this->_height; }
427
+    function get_height() { return $this->_height; }
428 428
 
429
-  function get_page_number() { return $this->_page_number; }
429
+    function get_page_number() { return $this->_page_number; }
430 430
 
431
-  function get_page_count() { return $this->_page_count; }
431
+    function get_page_count() { return $this->_page_count; }
432 432
 
433
-  function set_page_number($num) { $this->_page_number = (int)$num; }
433
+    function set_page_number($num) { $this->_page_number = (int)$num; }
434 434
 
435
-  function set_page_count($count) { $this->_page_count = (int)$count; }
435
+    function set_page_count($count) { $this->_page_count = (int)$count; }
436 436
 
437 437
 
438
-  /**
439
-   * Sets the line style
440
-   *
441
-   * @param float width
442
-   * @param string corner
443
-   * @param string join
444
-   * @param array dash
445
-   */
446
-  protected function _set_line_style($width, $cap, $join, $dash) {
438
+    /**
439
+     * Sets the line style
440
+     *
441
+     * @param float width
442
+     * @param string corner
443
+     * @param string join
444
+     * @param array dash
445
+     */
446
+    protected function _set_line_style($width, $cap, $join, $dash) {
447 447
 
448 448
     if ( count($dash) == 1 )
449
-      $dash[] = $dash[0];
449
+        $dash[] = $dash[0];
450 450
 
451 451
     if ( count($dash) > 1 )
452
-      $this->_pdf->setdashpattern("dasharray={" . join(" ", $dash) . "}");
452
+        $this->_pdf->setdashpattern("dasharray={" . join(" ", $dash) . "}");
453 453
     else
454
-      $this->_pdf->setdash(0,0);
454
+        $this->_pdf->setdash(0,0);
455 455
 
456 456
     switch ( $join ) {
457 457
     case "miter":
458 458
       $this->_pdf->setlinejoin(0);
459
-      break;
459
+        break;
460 460
 
461 461
     case "round":
462 462
       $this->_pdf->setlinejoin(1);
463
-      break;
463
+        break;
464 464
 
465 465
     case "bevel":
466 466
       $this->_pdf->setlinejoin(2);
467
-      break;
467
+        break;
468 468
 
469 469
     default:
470 470
       break;
@@ -473,15 +473,15 @@  discard block
 block discarded – undo
473 473
     switch ( $cap ) {
474 474
     case "butt":
475 475
       $this->_pdf->setlinecap(0);
476
-      break;
476
+        break;
477 477
 
478 478
     case "round":
479 479
       $this->_pdf->setlinecap(1);
480
-      break;
480
+        break;
481 481
 
482 482
     case "square":
483 483
       $this->_pdf->setlinecap(2);
484
-      break;
484
+        break;
485 485
 
486 486
     default:
487 487
       break;
@@ -489,69 +489,69 @@  discard block
 block discarded – undo
489 489
 
490 490
     $this->_pdf->setlinewidth($width);
491 491
 
492
-  }
492
+    }
493 493
 
494
-  /**
495
-   * Sets the line color
496
-   *
497
-   * @param array $color array(r,g,b)
498
-   */
499
-  protected function _set_stroke_color($color) {
494
+    /**
495
+     * Sets the line color
496
+     *
497
+     * @param array $color array(r,g,b)
498
+     */
499
+    protected function _set_stroke_color($color) {
500 500
     if($this->_last_stroke_color == $color)
501
-    	return;
501
+        return;
502 502
 
503 503
     $this->_last_stroke_color = $color;
504 504
 
505 505
     list($r,$g,$b) = $color;
506 506
     $this->_pdf->setcolor("stroke", "rgb", $r, $g, $b, 0);
507
-  }
508
-
509
-  /**
510
-   * Sets the fill color
511
-   *
512
-   * @param array $color array(r,g,b)
513
-   */
514
-  protected function _set_fill_color($color) {
507
+    }
508
+
509
+    /**
510
+     * Sets the fill color
511
+     *
512
+     * @param array $color array(r,g,b)
513
+     */
514
+    protected function _set_fill_color($color) {
515 515
     if($this->_last_fill_color == $color)
516
-    	return;
516
+        return;
517 517
 
518 518
     $this->_last_fill_color = $color;
519 519
 
520 520
     list($r,$g,$b) = $color;
521 521
     $this->_pdf->setcolor("fill", "rgb", $r, $g, $b, 0);
522
-  }
522
+    }
523 523
 
524
-  /**
525
-   * Loads a specific font and stores the corresponding descriptor.
526
-   *
527
-   * @param string $font
528
-   * @return int the font descriptor for the font
529
-   */
530
-  protected function _load_font($font, $encoding = null, $options = "") {
524
+    /**
525
+     * Loads a specific font and stores the corresponding descriptor.
526
+     *
527
+     * @param string $font
528
+     * @return int the font descriptor for the font
529
+     */
530
+    protected function _load_font($font, $encoding = null, $options = "") {
531 531
 
532 532
     // Check if the font is a native PDF font
533 533
     // Embed non-native fonts
534 534
     $native_fonts = array("courier", "courier-bold", "courier-oblique", "courier-boldoblique",
535
-                          "helvetica", "helvetica-bold", "helvetica-oblique", "helvetica-boldoblique",
536
-                          "times-roman", "times-bold", "times-italic", "times-bolditalic",
537
-                          "symbol", "zapfdinbats");
535
+                            "helvetica", "helvetica-bold", "helvetica-oblique", "helvetica-boldoblique",
536
+                            "times-roman", "times-bold", "times-italic", "times-bolditalic",
537
+                            "symbol", "zapfdinbats");
538 538
 
539 539
     $test = strtolower(basename($font));
540 540
     if ( in_array($test, $native_fonts) ) {
541
-      $font = basename($font);
541
+        $font = basename($font);
542 542
 
543 543
     } else {
544
-      // Embed non-native fonts
545
-      $options .= " embedding=true";
544
+        // Embed non-native fonts
545
+        $options .= " embedding=true";
546 546
     }
547 547
 
548 548
     if ( is_null($encoding) ) {
549 549
 
550
-      // Unicode encoding is only available for the commerical
551
-      // version of PDFlib and not PDFlib-Lite
552
-      if ( defined("DOMPDF_PDFLIB_LICENSE") )
550
+        // Unicode encoding is only available for the commerical
551
+        // version of PDFlib and not PDFlib-Lite
552
+        if ( defined("DOMPDF_PDFLIB_LICENSE") )
553 553
         $encoding = "unicode";
554
-      else
554
+        else
555 555
         $encoding = "auto";
556 556
 
557 557
     }
@@ -559,28 +559,28 @@  discard block
 block discarded – undo
559 559
     $key = $font .":". $encoding .":". $options;
560 560
 
561 561
     if ( isset($this->_fonts[$key]) )
562
-      return $this->_fonts[$key];
562
+        return $this->_fonts[$key];
563 563
 
564 564
     else {
565 565
 
566
-      $this->_fonts[$key] = $this->_pdf->load_font($font, $encoding, $options);
567
-      return $this->_fonts[$key];
566
+        $this->_fonts[$key] = $this->_pdf->load_font($font, $encoding, $options);
567
+        return $this->_fonts[$key];
568 568
 
569 569
     }
570 570
 
571
-  }
571
+    }
572 572
 
573
-  /**
574
-   * Remaps y coords from 4th to 1st quadrant
575
-   *
576
-   * @param float $y
577
-   * @return float
578
-   */
579
-  protected function y($y) { return $this->_height - $y; }
573
+    /**
574
+     * Remaps y coords from 4th to 1st quadrant
575
+     *
576
+     * @param float $y
577
+     * @return float
578
+     */
579
+    protected function y($y) { return $this->_height - $y; }
580 580
 
581
-  //........................................................................
581
+    //........................................................................
582 582
 
583
-  function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
583
+    function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
584 584
     $this->_set_line_style($width, "butt", "", $style);
585 585
     $this->_set_stroke_color($color);
586 586
 
@@ -590,11 +590,11 @@  discard block
 block discarded – undo
590 590
     $this->_pdf->moveto($x1,$y1);
591 591
     $this->_pdf->lineto($x2, $y2);
592 592
     $this->_pdf->stroke();
593
-  }
593
+    }
594 594
 
595
-  //........................................................................
595
+    //........................................................................
596 596
 
597
-  function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
597
+    function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
598 598
     $this->_set_stroke_color($color);
599 599
     $this->_set_line_style($width, "square", "miter", $style);
600 600
 
@@ -602,93 +602,93 @@  discard block
 block discarded – undo
602 602
 
603 603
     $this->_pdf->rect($x1, $y1, $w, $h);
604 604
     $this->_pdf->stroke();
605
-  }
605
+    }
606 606
 
607
-  //........................................................................
607
+    //........................................................................
608 608
 
609
-  function filled_rectangle($x1, $y1, $w, $h, $color) {
609
+    function filled_rectangle($x1, $y1, $w, $h, $color) {
610 610
     $this->_set_fill_color($color);
611 611
 
612 612
     $y1 = $this->y($y1) - $h;
613 613
 
614 614
     $this->_pdf->rect($x1, $y1, $w, $h);
615 615
     $this->_pdf->fill();
616
-  }
616
+    }
617 617
 
618
-  //........................................................................
618
+    //........................................................................
619 619
 
620
-  function polygon($points, $color, $width = null, $style = null, $fill = false) {
620
+    function polygon($points, $color, $width = null, $style = null, $fill = false) {
621 621
 
622 622
     $this->_set_fill_color($color);
623 623
     $this->_set_stroke_color($color);
624 624
 
625 625
     if ( !$fill && isset($width) )
626
-      $this->_set_line_style($width, "square", "miter", $style);
626
+        $this->_set_line_style($width, "square", "miter", $style);
627 627
 
628 628
     $y = $this->y(array_pop($points));
629 629
     $x = array_pop($points);
630 630
     $this->_pdf->moveto($x,$y);
631 631
 
632 632
     while (count($points) > 1) {
633
-      $y = $this->y(array_pop($points));
634
-      $x = array_pop($points);
635
-      $this->_pdf->lineto($x,$y);
633
+        $y = $this->y(array_pop($points));
634
+        $x = array_pop($points);
635
+        $this->_pdf->lineto($x,$y);
636 636
     }
637 637
 
638 638
     if ( $fill )
639
-      $this->_pdf->fill();
639
+        $this->_pdf->fill();
640 640
     else
641
-      $this->_pdf->closepath_stroke();
642
-  }
641
+        $this->_pdf->closepath_stroke();
642
+    }
643 643
 
644
-  //........................................................................
644
+    //........................................................................
645 645
 
646
-  function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false) {
646
+    function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false) {
647 647
 
648 648
     $this->_set_fill_color($color);
649 649
     $this->_set_stroke_color($color);
650 650
 
651 651
     if ( !$fill && isset($width) )
652
-      $this->_set_line_style($width, "round", "round", $style);
652
+        $this->_set_line_style($width, "round", "round", $style);
653 653
 
654 654
     $y = $this->y($y);
655 655
 
656 656
     $this->_pdf->circle($x, $y, $r);
657 657
 
658 658
     if ( $fill )
659
-      $this->_pdf->fill();
659
+        $this->_pdf->fill();
660 660
     else
661
-      $this->_pdf->stroke();
661
+        $this->_pdf->stroke();
662 662
 
663
-  }
663
+    }
664 664
 
665
-  //........................................................................
665
+    //........................................................................
666 666
 
667
-  function image($img_url, $img_type, $x, $y, $w, $h) {
667
+    function image($img_url, $img_type, $x, $y, $w, $h) {
668 668
     $w = (int)$w;
669 669
     $h = (int)$h;
670 670
 
671 671
     $img_type = strtolower($img_type);
672 672
 
673 673
     if ( $img_type === "jpg" )
674
-      $img_type = "jpeg";
674
+        $img_type = "jpeg";
675 675
 
676 676
     if ( isset($this->_imgs[$img_url]) )
677
-      $img = $this->_imgs[$img_url];
677
+        $img = $this->_imgs[$img_url];
678 678
 
679 679
     else {
680 680
 
681
-      $img = $this->_imgs[$img_url] = $this->_pdf->load_image($img_type, $img_url, "");
681
+        $img = $this->_imgs[$img_url] = $this->_pdf->load_image($img_type, $img_url, "");
682 682
     }
683 683
 
684 684
     $y = $this->y($y) - $h;
685 685
     $this->_pdf->fit_image($img, $x, $y, 'boxsize={'. "$w $h" .'} fitmethod=entire');
686 686
 
687
-  }
687
+    }
688 688
 
689
-  //........................................................................
689
+    //........................................................................
690 690
 
691
-  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
691
+    function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
692 692
     $fh = $this->_load_font($font);
693 693
 
694 694
     $this->_pdf->setfont($fh, $size);
@@ -701,72 +701,72 @@  discard block
 block discarded – undo
701 701
 
702 702
     $this->_pdf->fit_textline($text, $x, $y, "rotate=$angle wordspacing=$adjust");
703 703
 
704
-  }
704
+    }
705 705
 
706
-  //........................................................................
706
+    //........................................................................
707 707
   
708
-  function javascript($code) {
708
+    function javascript($code) {
709 709
     // Not implemented
710
-  }
710
+    }
711 711
 
712
-  //........................................................................
712
+    //........................................................................
713 713
 
714
-  /**
715
-   * Add a named destination (similar to <a name="foo">...</a> in html)
716
-   *
717
-   * @param string $anchorname The name of the named destination
718
-   */
719
-  function add_named_dest($anchorname) {
714
+    /**
715
+     * Add a named destination (similar to <a name="foo">...</a> in html)
716
+     *
717
+     * @param string $anchorname The name of the named destination
718
+     */
719
+    function add_named_dest($anchorname) {
720 720
     $this->_pdf->add_nameddest($anchorname,"");
721
-  }
721
+    }
722 722
 
723
-  //........................................................................
723
+    //........................................................................
724 724
 
725
-  /**
726
-   * Add a link to the pdf
727
-   *
728
-   * @param string $url The url to link to
729
-   * @param float  $x   The x position of the link
730
-   * @param float  $y   The y position of the link
731
-   * @param float  $width   The width of the link
732
-   * @param float  $height   The height of the link
733
-   */
734
-  function add_link($url, $x, $y, $width, $height) {
725
+    /**
726
+     * Add a link to the pdf
727
+     *
728
+     * @param string $url The url to link to
729
+     * @param float  $x   The x position of the link
730
+     * @param float  $y   The y position of the link
731
+     * @param float  $width   The width of the link
732
+     * @param float  $height   The height of the link
733
+     */
734
+    function add_link($url, $x, $y, $width, $height) {
735 735
 
736 736
     $y = $this->y($y) - $height;
737 737
     if ( strpos($url, '#') === 0 ) {
738
-      // Local link
739
-      $name = substr($url,1);
740
-      if ( $name )
738
+        // Local link
739
+        $name = substr($url,1);
740
+        if ( $name )
741 741
         $this->_pdf->create_annotation($x, $y, $x + $width, $y + $height, 'Link', "contents={$url} destname=". substr($url,1) . " linewidth=0");
742 742
     } else {
743 743
 
744
-      list($proto, $host, $path, $file) = explode_url($url);
744
+        list($proto, $host, $path, $file) = explode_url($url);
745 745
 
746
-      if ( $proto == "" || $proto === "file://" )
746
+        if ( $proto == "" || $proto === "file://" )
747 747
         return; // Local links are not allowed
748
-      $url = build_url($proto, $host, $path, $file);
749
-      $url = '{' . rawurldecode($url) . '}';
748
+        $url = build_url($proto, $host, $path, $file);
749
+        $url = '{' . rawurldecode($url) . '}';
750 750
       
751
-      $action = $this->_pdf->create_action("URI", "url=" . $url);
752
-      $this->_pdf->create_annotation($x, $y, $x + $width, $y + $height, 'Link', "contents={$url} action={activate=$action} linewidth=0");
751
+        $action = $this->_pdf->create_action("URI", "url=" . $url);
752
+        $this->_pdf->create_annotation($x, $y, $x + $width, $y + $height, 'Link', "contents={$url} action={activate=$action} linewidth=0");
753
+    }
753 754
     }
754
-  }
755 755
 
756
-  //........................................................................
756
+    //........................................................................
757 757
 
758
-  function get_text_width($text, $font, $size, $spacing = 0) {
758
+    function get_text_width($text, $font, $size, $spacing = 0) {
759 759
     $fh = $this->_load_font($font);
760 760
 
761 761
     // Determine the additional width due to extra spacing
762 762
     $num_spaces = mb_substr_count($text," ");
763 763
     $delta = $spacing * $num_spaces;
764 764
     return $this->_pdf->stringwidth($text, $fh, $size) + $delta;
765
-  }
765
+    }
766 766
 
767
-  //........................................................................
767
+    //........................................................................
768 768
 
769
-  function get_font_height($font, $size) {
769
+    function get_font_height($font, $size) {
770 770
 
771 771
     $fh = $this->_load_font($font);
772 772
 
@@ -777,54 +777,54 @@  discard block
 block discarded – undo
777 777
 
778 778
     // $desc is usually < 0,
779 779
     return self::FONT_HEIGHT_SCALE * $size * ($asc - $desc);
780
-  }
781
-
782
-  //........................................................................
783
-
784
-  /**
785
-   * Writes text at the specified x and y coordinates on every page
786
-   *
787
-   * The strings '{PAGE_NUM}' and '{PAGE_COUNT}' are automatically replaced
788
-   * with their current values.
789
-   *
790
-   * See {@link Style::munge_colour()} for the format of the colour array.
791
-   *
792
-   * @param float $x
793
-   * @param float $y
794
-   * @param string $text the text to write
795
-   * @param string $font the font file to use
796
-   * @param float $size the font size, in points
797
-   * @param array $color
798
-   * @param float $adjust word spacing adjustment
799
-   * @param float $angle angle to write the text at, measured CW starting from the x-axis
800
-   */
801
-  function page_text($x, $y, $text, $font, $size, $color = array(0,0,0),
802
-                     $adjust = 0, $angle = 0,  $blend = "Normal", $opacity = 1.0) {
780
+    }
781
+
782
+    //........................................................................
783
+
784
+    /**
785
+     * Writes text at the specified x and y coordinates on every page
786
+     *
787
+     * The strings '{PAGE_NUM}' and '{PAGE_COUNT}' are automatically replaced
788
+     * with their current values.
789
+     *
790
+     * See {@link Style::munge_colour()} for the format of the colour array.
791
+     *
792
+     * @param float $x
793
+     * @param float $y
794
+     * @param string $text the text to write
795
+     * @param string $font the font file to use
796
+     * @param float $size the font size, in points
797
+     * @param array $color
798
+     * @param float $adjust word spacing adjustment
799
+     * @param float $angle angle to write the text at, measured CW starting from the x-axis
800
+     */
801
+    function page_text($x, $y, $text, $font, $size, $color = array(0,0,0),
802
+                        $adjust = 0, $angle = 0,  $blend = "Normal", $opacity = 1.0) {
803 803
     $_t = "text";
804 804
     $this->_page_text[] = compact("_t", "x", "y", "text", "font", "size", "color", "adjust", "angle");
805
-  }
806
-
807
-  //........................................................................
808
-
809
-  /**
810
-   * Processes a script on every page
811
-   *
812
-   * The variables $pdf, $PAGE_NUM, and $PAGE_COUNT are available.
813
-   *
814
-   * This function can be used to add page numbers to all pages
815
-   * after the first one, for example.
816
-   *
817
-   * @param string $code the script code
818
-   * @param string $type the language type for script
819
-   */
820
-  function page_script($code, $type = "text/php") {
805
+    }
806
+
807
+    //........................................................................
808
+
809
+    /**
810
+     * Processes a script on every page
811
+     *
812
+     * The variables $pdf, $PAGE_NUM, and $PAGE_COUNT are available.
813
+     *
814
+     * This function can be used to add page numbers to all pages
815
+     * after the first one, for example.
816
+     *
817
+     * @param string $code the script code
818
+     * @param string $type the language type for script
819
+     */
820
+    function page_script($code, $type = "text/php") {
821 821
     $_t = "script";
822 822
     $this->_page_text[] = compact("_t", "code", "type");
823
-  }
823
+    }
824 824
 
825
-  //........................................................................
825
+    //........................................................................
826 826
 
827
-  function new_page() {
827
+    function new_page() {
828 828
 
829 829
     // Add objects to the current page
830 830
     $this->_place_objects();
@@ -833,69 +833,69 @@  discard block
 block discarded – undo
833 833
     $this->_pdf->begin_page_ext($this->_width, $this->_height, "");
834 834
     $this->_page_number = ++$this->_page_count;
835 835
 
836
-  }
836
+    }
837 837
 
838
-  //........................................................................
838
+    //........................................................................
839 839
 
840
-  /**
841
-   * Add text to each page after rendering is complete
842
-   */
843
-  protected function _add_page_text() {
840
+    /**
841
+     * Add text to each page after rendering is complete
842
+     */
843
+    protected function _add_page_text() {
844 844
 
845 845
     if ( !count($this->_page_text) )
846
-      return;
846
+        return;
847 847
 
848 848
     $this->_pdf->suspend_page("");
849 849
 
850 850
     for ($p = 1; $p <= $this->_page_count; $p++) {
851
-      $this->_pdf->resume_page("pagenumber=$p");
851
+        $this->_pdf->resume_page("pagenumber=$p");
852 852
 
853
-      foreach ($this->_page_text as $pt) {
853
+        foreach ($this->_page_text as $pt) {
854 854
         extract($pt);
855 855
 
856 856
         switch ($_t) {
857 857
 
858 858
         case "text":
859 859
           $text = str_replace(array("{PAGE_NUM}","{PAGE_COUNT}"),
860
-                              array($p, $this->_page_count), $text);
861
-          $this->text($x, $y, $text, $font, $size, $color, $adjust, $angle);
862
-          break;
860
+                                array($p, $this->_page_count), $text);
861
+            $this->text($x, $y, $text, $font, $size, $color, $adjust, $angle);
862
+            break;
863 863
 
864 864
         case "script":
865 865
           if (!$eval) {
866 866
             $eval = new PHP_Evaluator($this);
867
-          }
868
-          $eval->evaluate($code, array('PAGE_NUM' => $p, 'PAGE_COUNT' => $this->_page_count));
869
-          break;
867
+            }
868
+            $eval->evaluate($code, array('PAGE_NUM' => $p, 'PAGE_COUNT' => $this->_page_count));
869
+            break;
870
+        }
870 871
         }
871
-      }
872 872
 
873
-      $this->_pdf->suspend_page("");
873
+        $this->_pdf->suspend_page("");
874 874
     }
875 875
 
876 876
     $this->_pdf->resume_page("pagenumber=".$this->_page_number);
877
-  }
877
+    }
878 878
 
879
-  //........................................................................
879
+    //........................................................................
880 880
 
881
-  function stream($filename, $options = null) {
881
+    function stream($filename, $options = null) {
882 882
 
883 883
     // Add page text
884 884
     $this->_add_page_text();
885 885
 
886 886
     if ( isset($options["compress"]) && $options["compress"] != 1 )
887
-      $this->_pdf->set_value("compress", 0);
887
+        $this->_pdf->set_value("compress", 0);
888 888
     else
889
-      $this->_pdf->set_value("compress", 6);
889
+        $this->_pdf->set_value("compress", 6);
890 890
 
891 891
     $this->_close();
892 892
 
893 893
     if ( self::$IN_MEMORY ) {
894
-      $data = $this->_pdf->get_buffer();
895
-      $size = strlen($data);
894
+        $data = $this->_pdf->get_buffer();
895
+        $size = strlen($data);
896 896
 
897 897
     } else
898
-      $size = filesize($this->_file);
898
+        $size = filesize($this->_file);
899 899
 
900 900
 
901 901
     $filename = str_replace(array("\n","'"),"", $filename);
@@ -908,63 +908,63 @@  discard block
 block discarded – undo
908 908
     //header("Content-length: " . $size);
909 909
 
910 910
     if ( self::$IN_MEMORY )
911
-      echo $data;
911
+        echo $data;
912 912
 
913 913
     else {
914 914
 
915
-      // Chunked readfile()
916
-      $chunk = (1 << 21); // 2 MB
917
-      $fh = fopen($this->_file, "rb");
918
-      if ( !$fh )
915
+        // Chunked readfile()
916
+        $chunk = (1 << 21); // 2 MB
917
+        $fh = fopen($this->_file, "rb");
918
+        if ( !$fh )
919 919
         throw new DOMPDF_Exception("Unable to load temporary PDF file: " . $this->_file);
920 920
 
921
-      while ( !feof($fh) )
921
+        while ( !feof($fh) )
922 922
         echo fread($fh,$chunk);
923
-      fclose($fh);
923
+        fclose($fh);
924 924
 
925
-      //debugpng
926
-      if (DEBUGPNG) print '[pdflib stream unlink '.$this->_file.']';
927
-      if (!DEBUGKEEPTEMP)
925
+        //debugpng
926
+        if (DEBUGPNG) print '[pdflib stream unlink '.$this->_file.']';
927
+        if (!DEBUGKEEPTEMP)
928 928
 
929
-      unlink($this->_file);
930
-      $this->_file = null;
929
+        unlink($this->_file);
930
+        $this->_file = null;
931 931
     }
932 932
 
933 933
     flush();
934 934
 
935 935
 
936
-  }
936
+    }
937 937
 
938
-  //........................................................................
938
+    //........................................................................
939 939
 
940
-  function output($options = null) {
940
+    function output($options = null) {
941 941
 
942 942
     // Add page text
943 943
     $this->_add_page_text();
944 944
 
945 945
     if ( isset($options["compress"]) && $options["compress"] != 1 )
946
-      $this->_pdf->set_value("compress", 0);
946
+        $this->_pdf->set_value("compress", 0);
947 947
     else
948
-      $this->_pdf->set_value("compress", 6);
948
+        $this->_pdf->set_value("compress", 6);
949 949
 
950 950
     $this->_close();
951 951
 
952 952
     if ( self::$IN_MEMORY )
953
-      $data = $this->_pdf->get_buffer();
953
+        $data = $this->_pdf->get_buffer();
954 954
 
955 955
     else {
956
-      $data = file_get_contents($this->_file);
956
+        $data = file_get_contents($this->_file);
957 957
 
958
-      //debugpng
959
-      if (DEBUGPNG) print '[pdflib output unlink '.$this->_file.']';
960
-      if (!DEBUGKEEPTEMP)
958
+        //debugpng
959
+        if (DEBUGPNG) print '[pdflib output unlink '.$this->_file.']';
960
+        if (!DEBUGKEEPTEMP)
961 961
 
962
-      unlink($this->_file);
963
-      $this->_file = null;
962
+        unlink($this->_file);
963
+        $this->_file = null;
964 964
     }
965 965
 
966 966
     return $data;
967
-  }
967
+    }
968 968
 }
969 969
 
970 970
 // Workaround for idiotic limitation on statics...
Please login to merge, or discard this patch.