Passed
Push — 1.10.x ( 88b3ac...12c7e7 )
by Angel Fernando Quiroz
46:55
created
main/inc/lib/phpdocx/pdf/www/examples.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 require_once("../dompdf_config.inc.php");
4 4
 if ( isset( $_POST["html"] ) ) {
5 5
 
6
-  if ( get_magic_quotes_gpc() )
6
+    if ( get_magic_quotes_gpc() )
7 7
     $_POST["html"] = stripslashes($_POST["html"]);
8 8
   
9
-  $dompdf = new DOMPDF();
10
-  $dompdf->load_html($_POST["html"]);
11
-  $dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
12
-  $dompdf->render();
9
+    $dompdf = new DOMPDF();
10
+    $dompdf->load_html($_POST["html"]);
11
+    $dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
12
+    $dompdf->render();
13 13
 
14
-  $dompdf->stream("dompdf_out.pdf");
14
+    $dompdf->stream("dompdf_out.pdf");
15 15
 
16
-  exit(0);
16
+    exit(0);
17 17
 }
18 18
 
19 19
 ?>
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 $dompdf = dirname(dirname($_SERVER["PHP_SELF"]));
43 43
 //echo '<li>['.$dompdf.']</li>';
44 44
 if ( $dompdf == '/' || $dompdf == '\\') {
45
-  $dompdf = '';
45
+    $dompdf = '';
46 46
 }
47 47
 //echo '<li>['.$dompdf.']</li>';
48 48
 $dompdf .= "/dompdf.php?base_path=" . rawurlencode("www/test/");
49 49
 //echo '<li>['.$dompdf.']</li>';
50 50
 foreach ( $test_files as $file ) {
51
-  $file = basename($file);
52
-  $arrow = "images/arrow_0" . rand(1, 6) . ".gif";  
53
-  echo "<li style=\"list-style-image: url('$arrow');\">\n";
54
-  echo $file;
55
-  echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") .  "\">PDF</a>]\n";
56
-  echo "</li>\n";
51
+    $file = basename($file);
52
+    $arrow = "images/arrow_0" . rand(1, 6) . ".gif";  
53
+    echo "<li style=\"list-style-image: url('$arrow');\">\n";
54
+    echo $file;
55
+    echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") .  "\">PDF</a>]\n";
56
+    echo "</li>\n";
57 57
 }
58 58
 ?>
59 59
 </ul>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 <select name="paper">
70 70
 <?php
71 71
 foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size )
72
-  echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
72
+    echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
73 73
 ?>
74 74
 </select>
75 75
 <select name="orientation">
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/www/head.inc 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 function li_arrow() {
3
-  return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
3
+    return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
4 4
 }
5 5
 function li_star() {
6
-  return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
6
+    return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
7 7
 }
8 8
 ?>
9 9
 <?php echo '<?' . 'xml version="1.0" encoding="iso-8859-1"?' . '>'; ?>
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_positioner.cls.php 1 patch
Indentation   +40 added lines, -41 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: inline_positioner.cls.php,v $
6
- * Created on: 2004-06-08
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: inline_positioner.cls.php,v $
6
+     * Created on: 2004-06-08
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: inline_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 /**
@@ -46,11 +45,11 @@  discard block
 block discarded – undo
46 45
  */
47 46
 class Inline_Positioner extends Positioner {
48 47
 
49
-  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
48
+    function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
50 49
 
51
-  //........................................................................
50
+    //........................................................................
52 51
 
53
-  function position() {
52
+    function position() {
54 53
     $cb = $this->_frame->get_containing_block();
55 54
 
56 55
     // Find our nearest block level parent and access its lines property.
@@ -65,11 +64,11 @@  discard block
 block discarded – undo
65 64
     // End debugging
66 65
 
67 66
     if ( !$p )
68
-      throw new DOMPDF_Exception("No block-level parent found.  Not good.");
67
+        throw new DOMPDF_Exception("No block-level parent found.  Not good.");
69 68
 
70 69
     $line = $p->get_current_line();
71 70
     
72 71
     $this->_frame->set_position($cb["x"] + $line["w"], $line["y"]);
73 72
 
74
-  }
73
+    }
75 74
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/image_cache.cls.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -1,54 +1,54 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: image_cache.cls.php,v $
6
- * Created on: 2004-08-08
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
- * - On getting type of images don't require any file endings
43
- *   and don't strip off url parameters,
44
- *   to allowing dynamically generated sites with image id
45
- *   in url parameters and not at end of url or missing file extension
46
- * @contributor Helmut Tischer <[email protected]>
47
- * @version dompdf_trunk_with_helmut_mods.20090524
48
- * - Made debug messages more individually configurable
49
- * @version 20090622
50
- * - don't cache broken image, but refer to original broken image replacement
51
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: image_cache.cls.php,v $
6
+     * Created on: 2004-08-08
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
+     * - On getting type of images don't require any file endings
43
+     *   and don't strip off url parameters,
44
+     *   to allowing dynamically generated sites with image id
45
+     *   in url parameters and not at end of url or missing file extension
46
+     * @contributor Helmut Tischer <[email protected]>
47
+     * @version dompdf_trunk_with_helmut_mods.20090524
48
+     * - Made debug messages more individually configurable
49
+     * @version 20090622
50
+     * - don't cache broken image, but refer to original broken image replacement
51
+     */
52 52
 
53 53
 /* $Id: image_cache.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
54 54
 
@@ -61,25 +61,25 @@  discard block
 block discarded – undo
61 61
  */
62 62
 class Image_Cache {
63 63
 
64
-  /**
65
-   * Array of downloaded images.  Cached so that identical images are
66
-   * not needlessly downloaded.
67
-   *
68
-   * @var array
69
-   */
70
-  static protected $_cache = array();
71
-
72
-
73
-  /**
74
-   * Resolve and fetch an image for use.
75
-   *
76
-   * @param string $url        The url of the image
77
-   * @param string $proto      Default protocol if none specified in $url
78
-   * @param string $host       Default host if none specified in $url
79
-   * @param string $base_path  Default path if none specified in $url
80
-   * @return array             An array with two elements: The local path to the image and the image extension
81
-   */
82
-  static function resolve_url($url, $proto, $host, $base_path) {
64
+    /**
65
+     * Array of downloaded images.  Cached so that identical images are
66
+     * not needlessly downloaded.
67
+     *
68
+     * @var array
69
+     */
70
+    static protected $_cache = array();
71
+
72
+
73
+    /**
74
+     * Resolve and fetch an image for use.
75
+     *
76
+     * @param string $url        The url of the image
77
+     * @param string $proto      Default protocol if none specified in $url
78
+     * @param string $host       Default host if none specified in $url
79
+     * @param string $base_path  Default path if none specified in $url
80
+     * @return array             An array with two elements: The local path to the image and the image extension
81
+     */
82
+    static function resolve_url($url, $proto, $host, $base_path) {
83 83
     global $_dompdf_warnings;
84 84
 
85 85
     $parsed_url = explode_url($url);
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
     $remote = $remote || ($parsed_url['protocol'] != "");
95 95
 
96 96
     if ( !DOMPDF_ENABLE_REMOTE && $remote ) {
97
-      $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
98
-      $ext = "png";
97
+        $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
98
+        $ext = "png";
99 99
 
100
-      //debugpng
101
-      if ($DEBUGPNG) $full_url_dbg = '(blockedremote)';
100
+        //debugpng
101
+        if ($DEBUGPNG) $full_url_dbg = '(blockedremote)';
102 102
 
103 103
     } else if ( DOMPDF_ENABLE_REMOTE && $remote ) {
104
-      // Download remote files to a temporary directory
105
-      $full_url = build_url($proto, $host, $base_path, $url);
104
+        // Download remote files to a temporary directory
105
+        $full_url = build_url($proto, $host, $base_path, $url);
106 106
 
107
-      if ( isset(self::$_cache[$full_url]) ) {
107
+        if ( isset(self::$_cache[$full_url]) ) {
108 108
         list($resolved_url,$ext) = self::$_cache[$full_url];
109 109
 
110 110
         //debugpng
111 111
         if ($DEBUGPNG) $full_url_dbg = $full_url.'(cache)';
112 112
 
113
-      } else {
113
+        } else {
114 114
 
115 115
         $resolved_url = tempnam(DOMPDF_TEMP_DIR, "ca_dompdf_img_");
116 116
         //debugpng
@@ -121,21 +121,21 @@  discard block
 block discarded – undo
121 121
         restore_error_handler();
122 122
 
123 123
         if ( strlen($image) == 0 ) {
124
-          //target image not found
125
-          $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
126
-          $ext = "png";
124
+            //target image not found
125
+            $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
126
+            $ext = "png";
127 127
 
128
-          //debugpng
129
-          if ($DEBUGPNG) $full_url_dbg = $full_url.'(missing)';
128
+            //debugpng
129
+            if ($DEBUGPNG) $full_url_dbg = $full_url.'(missing)';
130 130
 
131 131
         } else {
132 132
 
133 133
         file_put_contents($resolved_url, $image);
134 134
 
135
-		//e.g. fetch.php?media=url.jpg&cache=1
136
-		//- Image file name might be one of the dynamic parts of the url, don't strip off!
137
-		//  if ( preg_match("/.*\.(\w+)/",$url,$match) ) $ext = $match[1];
138
-		//- a remote url does not need to have a file extension at all
135
+        //e.g. fetch.php?media=url.jpg&cache=1
136
+        //- Image file name might be one of the dynamic parts of the url, don't strip off!
137
+        //  if ( preg_match("/.*\.(\w+)/",$url,$match) ) $ext = $match[1];
138
+        //- a remote url does not need to have a file extension at all
139 139
         //- local cached file does not have a matching file extension
140 140
         //Therefore get image type from the content
141 141
 
@@ -146,33 +146,33 @@  discard block
 block discarded – undo
146 146
         $imagetypes = array('','gif','jpeg','png','swf');
147 147
         $ext = $imagetypes[$imagedim[2]];
148 148
         if ( rename($resolved_url,$resolved_url.'.'.$ext) ) {
149
-          $resolved_url .= '.'.$ext;
149
+            $resolved_url .= '.'.$ext;
150 150
         }
151 151
  
152
- 		//Don't put replacement image into cache - otherwise it will be deleted on cache cleanup.
153
- 		//Only execute on successfull caching of remote image.
152
+            //Don't put replacement image into cache - otherwise it will be deleted on cache cleanup.
153
+            //Only execute on successfull caching of remote image.
154 154
         self::$_cache[$full_url] = array($resolved_url,$ext);
155 155
 
156 156
         } else {
157
-          //target image is not valid.
158
-          unlink($resolved_url);
157
+            //target image is not valid.
158
+            unlink($resolved_url);
159 159
           
160
-          $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
161
-          $ext = "png";
160
+            $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
161
+            $ext = "png";
162 162
         }
163 163
         }
164 164
 
165
-      }
165
+        }
166 166
 
167 167
     } else {
168 168
 
169
-      $resolved_url = build_url($proto, $host, $base_path, $url);
170
-      if ($DEBUGPNG) print 'build_url('.$proto.','.$host.','.$base_path.','.$url.')('.$resolved_url.')';
169
+        $resolved_url = build_url($proto, $host, $base_path, $url);
170
+        if ($DEBUGPNG) print 'build_url('.$proto.','.$host.','.$base_path.','.$url.')('.$resolved_url.')';
171 171
 
172
-      if ( !preg_match("/.*\.(\w+)/",$url,$match) ) {
172
+        if ( !preg_match("/.*\.(\w+)/",$url,$match) ) {
173 173
         //debugpng
174 174
         if ($DEBUGPNG) print '[resolve_url exception '.$url.']';
175
-          throw new DOMPDF_Exception("Unknown image type: $url.");
175
+            throw new DOMPDF_Exception("Unknown image type: $url.");
176 176
         }
177 177
 
178 178
         $ext = $match[1];
@@ -184,35 +184,35 @@  discard block
 block discarded – undo
184 184
 
185 185
     if ( !is_readable($resolved_url) || !filesize($resolved_url) ) {
186 186
 
187
-      //debugpng
188
-      if ($DEBUGPNG) $full_url_dbg .= '(nocache'.$resolved_url.')';
187
+        //debugpng
188
+        if ($DEBUGPNG) $full_url_dbg .= '(nocache'.$resolved_url.')';
189 189
 
190
-      $_dompdf_warnings[] = "File " .$resolved_url . " is not readable or is an empty file.\n";
191
-      $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
192
-      $ext = "png";
190
+        $_dompdf_warnings[] = "File " .$resolved_url . " is not readable or is an empty file.\n";
191
+        $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
192
+        $ext = "png";
193 193
     }
194 194
 
195 195
     //debugpng
196 196
     if ($DEBUGPNG) print '[resolve_url '.$url.'|'.$full_url_dbg.'|'.$resolved_url.'|'.$ext.']';
197 197
 
198 198
     return array($resolved_url, $ext);
199
-  }
199
+    }
200 200
 
201
-  /**
202
-   * Unlink all cached images (i.e. temporary images either downloaded
203
-   * or converted)
204
-   */
205
-  static function clear() {
201
+    /**
202
+     * Unlink all cached images (i.e. temporary images either downloaded
203
+     * or converted)
204
+     */
205
+    static function clear() {
206 206
     if ( count(self::$_cache) ) {
207
-      while ($entry = array_shift(self::$_cache)) {
207
+        while ($entry = array_shift(self::$_cache)) {
208 208
         list($file, $ext) = $entry;
209 209
         //debugpng
210 210
         if (DEBUGPNG) print '[clear unlink '.$file.']';
211 211
         if (!DEBUGKEEPTEMP)
212
-          //XXX: Should we have some kind of fallback or warning if unlink() fails?
213
-          unlink($file);
214
-      }
212
+            //XXX: Should we have some kind of fallback or warning if unlink() fails?
213
+            unlink($file);
214
+        }
215
+    }
215 216
     }
216
-  }
217 217
 
218 218
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame.cls.php 1 patch
Indentation   +343 added lines, -344 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: frame.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -53,105 +52,105 @@  discard block
 block discarded – undo
53 52
  */
54 53
 class Frame {
55 54
   
56
-  /**
57
-   * The DOMNode object this frame represents
58
-   *
59
-   * @var DOMNode
60
-   */
61
-  protected $_node;
62
-
63
-  /**
64
-   * Unique identifier for this frame.  Used to reference this frame
65
-   * via the node.
66
-   *
67
-   * @var string
68
-   */
69
-  protected $_id;
70
-
71
-  /**
72
-   * Unique id counter
73
-   */
74
-  static protected $ID_COUNTER = 0;
55
+    /**
56
+     * The DOMNode object this frame represents
57
+     *
58
+     * @var DOMNode
59
+     */
60
+    protected $_node;
61
+
62
+    /**
63
+     * Unique identifier for this frame.  Used to reference this frame
64
+     * via the node.
65
+     *
66
+     * @var string
67
+     */
68
+    protected $_id;
69
+
70
+    /**
71
+     * Unique id counter
72
+     */
73
+    static protected $ID_COUNTER = 0;
75 74
   
76
-  /**
77
-   * This frame's calculated style
78
-   *
79
-   * @var Style
80
-   */
81
-  protected $_style;
82
-
83
-  /**
84
-   * This frame's original style.  Needed for cases where frames are
85
-   * split across pages.
86
-   *
87
-   * @var Style
88
-   */
89
-  protected $_original_style;
75
+    /**
76
+     * This frame's calculated style
77
+     *
78
+     * @var Style
79
+     */
80
+    protected $_style;
81
+
82
+    /**
83
+     * This frame's original style.  Needed for cases where frames are
84
+     * split across pages.
85
+     *
86
+     * @var Style
87
+     */
88
+    protected $_original_style;
90 89
   
91
-  /**
92
-   * This frame's parent in the document tree.
93
-   *
94
-   * @var Frame
95
-   */
96
-  protected $_parent;
97
-
98
-  /**
99
-   * This frame's first child.  All children are handled as a
100
-   * doubly-linked list.
101
-   *
102
-   * @var Frame
103
-   */
104
-  protected $_first_child;
105
-
106
-  /**
107
-   * This frame's last child.
108
-   *
109
-   * @var Frame
110
-   */
111
-  protected $_last_child;
112
-
113
-  /**
114
-   * This frame's previous sibling in the document tree.
115
-   *
116
-   * @var Frame
117
-   */
118
-  protected $_prev_sibling;
119
-
120
-  /**
121
-   * This frame's next sibling in the document tree.
122
-   *
123
-   * @var Frame
124
-   */
125
-  protected $_next_sibling;
90
+    /**
91
+     * This frame's parent in the document tree.
92
+     *
93
+     * @var Frame
94
+     */
95
+    protected $_parent;
96
+
97
+    /**
98
+     * This frame's first child.  All children are handled as a
99
+     * doubly-linked list.
100
+     *
101
+     * @var Frame
102
+     */
103
+    protected $_first_child;
104
+
105
+    /**
106
+     * This frame's last child.
107
+     *
108
+     * @var Frame
109
+     */
110
+    protected $_last_child;
111
+
112
+    /**
113
+     * This frame's previous sibling in the document tree.
114
+     *
115
+     * @var Frame
116
+     */
117
+    protected $_prev_sibling;
118
+
119
+    /**
120
+     * This frame's next sibling in the document tree.
121
+     *
122
+     * @var Frame
123
+     */
124
+    protected $_next_sibling;
126 125
   
127
-  /**
128
-   * This frame's containing block (used in layout): array(x, y, w, h)
129
-   *
130
-   * @var array
131
-   */
132
-  protected $_containing_block;
133
-
134
-  /**
135
-   * Position on the page of the top-left corner of the margin box of
136
-   * this frame: array(x,y)
137
-   *
138
-   * @var array
139
-   */
140
-  protected $_position;
141
-
142
-  /**
143
-   * This frame's decorator
144
-   *
145
-   * @var Frame_Decorator
146
-   */
147
-  protected $_decorator;
148
-    
149
-  /**
150
-   * Class constructor
151
-   *
152
-   * @param DOMNode $node the DOMNode this frame represents
153
-   */
154
-  function __construct(DomNode $node) {
126
+    /**
127
+     * This frame's containing block (used in layout): array(x, y, w, h)
128
+     *
129
+     * @var array
130
+     */
131
+    protected $_containing_block;
132
+
133
+    /**
134
+     * Position on the page of the top-left corner of the margin box of
135
+     * this frame: array(x,y)
136
+     *
137
+     * @var array
138
+     */
139
+    protected $_position;
140
+
141
+    /**
142
+     * This frame's decorator
143
+     *
144
+     * @var Frame_Decorator
145
+     */
146
+    protected $_decorator;
147
+    
148
+    /**
149
+     * Class constructor
150
+     *
151
+     * @param DOMNode $node the DOMNode this frame represents
152
+     */
153
+    function __construct(DomNode $node) {
155 154
     $this->_node = $node;
156 155
       
157 156
     $this->_parent = null;
@@ -163,48 +162,48 @@  discard block
 block discarded – undo
163 162
     $this->_original_style = null;
164 163
     
165 164
     $this->_containing_block = array("x" => null,
166
-                                     "y" => null,
167
-                                     "w" => null,
168
-                                     "h" => null);
165
+                                        "y" => null,
166
+                                        "w" => null,
167
+                                        "h" => null);
169 168
     $this->_position = array("x" => null,
170
-                             "y" => null);
169
+                                "y" => null);
171 170
 
172 171
     $this->_decorator = null;
173 172
 
174 173
     $this->set_id( self::$ID_COUNTER++ );
175
-  }
174
+    }
176 175
 
177
-  /**
178
-   * "Destructor": forcibly free all references held by this frame
179
-   *
180
-   * @param bool $recursive if true, call dispose on all children
181
-   */
182
-  function dispose($recursive = false) {
176
+    /**
177
+     * "Destructor": forcibly free all references held by this frame
178
+     *
179
+     * @param bool $recursive if true, call dispose on all children
180
+     */
181
+    function dispose($recursive = false) {
183 182
 
184 183
     if ( $recursive ) {
185
-      while ( $child = $this->_first_child )
184
+        while ( $child = $this->_first_child )
186 185
         $child->dispose(true);
187 186
     }
188 187
 
189 188
     // Remove this frame from the tree
190 189
     if ( $this->_prev_sibling ) {
191
-      $this->_prev_sibling->_next_sibling = $this->_next_sibling;      
190
+        $this->_prev_sibling->_next_sibling = $this->_next_sibling;      
192 191
     }
193 192
 
194 193
     if ( $this->_next_sibling ) {
195
-      $this->_next_sibling->_prev_sibling = $this->_prev_sibling;
194
+        $this->_next_sibling->_prev_sibling = $this->_prev_sibling;
196 195
     }
197 196
 
198 197
     if ( $this->_parent && $this->_parent->_first_child === $this ) {
199
-      $this->_parent->_first_child = $this->_next_sibling;
198
+        $this->_parent->_first_child = $this->_next_sibling;
200 199
     }
201 200
 
202 201
     if ( $this->_parent && $this->_parent->_last_child === $this ) {
203
-      $this->_parent->_last_child = $this->_prev_sibling;
202
+        $this->_parent->_last_child = $this->_prev_sibling;
204 203
     }
205 204
 
206 205
     if ( $this->_parent ) {
207
-      $this->_parent->get_node()->removeChild($this->_node);
206
+        $this->_parent->get_node()->removeChild($this->_node);
208 207
     }
209 208
 
210 209
     $this->_style->dispose();
@@ -212,369 +211,369 @@  discard block
 block discarded – undo
212 211
     $this->_original_style->dispose();
213 212
     unset($this->_original_style);
214 213
     
215
-  }
214
+    }
216 215
 
217
-  // Re-initialize the frame
218
-  function reset() {
216
+    // Re-initialize the frame
217
+    function reset() {
219 218
     $this->_position = array("x" => null,
220
-                             "y" => null);
219
+                                "y" => null);
221 220
     $this->_containing_block = array("x" => null,
222
-                                     "y" => null,
223
-                                     "w" => null,
224
-                                     "h" => null);
221
+                                        "y" => null,
222
+                                        "w" => null,
223
+                                        "h" => null);
225 224
 
226 225
     unset($this->_style);    
227 226
     $this->_style = clone $this->_original_style;
228 227
     
229
-  }
228
+    }
230 229
   
231
-  //........................................................................
232
-
233
-  // Accessor methods
234
-  function get_node() { return $this->_node; }
235
-  function get_id() { return $this->_id; }
236
-  function get_style() { return $this->_style; }
237
-  function get_original_style() { return $this->_original_style; }
238
-  function get_parent() { return $this->_parent; }
239
-  function get_decorator() { return $this->_decorator; }
240
-  function get_first_child() { return $this->_first_child; }
241
-  function get_last_child() { return $this->_last_child; }
242
-  function get_prev_sibling() { return $this->_prev_sibling; }
243
-  function get_next_sibling() { return $this->_next_sibling; }
244
-
245
-  function get_children() { return new FrameList($this); }
230
+    //........................................................................
231
+
232
+    // Accessor methods
233
+    function get_node() { return $this->_node; }
234
+    function get_id() { return $this->_id; }
235
+    function get_style() { return $this->_style; }
236
+    function get_original_style() { return $this->_original_style; }
237
+    function get_parent() { return $this->_parent; }
238
+    function get_decorator() { return $this->_decorator; }
239
+    function get_first_child() { return $this->_first_child; }
240
+    function get_last_child() { return $this->_last_child; }
241
+    function get_prev_sibling() { return $this->_prev_sibling; }
242
+    function get_next_sibling() { return $this->_next_sibling; }
243
+
244
+    function get_children() { return new FrameList($this); }
246 245
   
247
-  // Layout property accessors
248
-  function get_containing_block($i = null) {
246
+    // Layout property accessors
247
+    function get_containing_block($i = null) {
249 248
     if ( isset($i) )
250
-      return $this->_containing_block[$i];    
249
+        return $this->_containing_block[$i];    
251 250
     return $this->_containing_block;
252
-  }
251
+    }
253 252
   
254
-  function get_position($i = null) {
253
+    function get_position($i = null) {
255 254
     if ( isset($i) )
256
-      return $this->_position[$i];
255
+        return $this->_position[$i];
257 256
     return array($this->_position["x"],
258
-                 $this->_position["y"],
259
-                 "x"=>$this->_position["x"],
260
-                 "y"=>$this->_position["y"]);
261
-  }
257
+                    $this->_position["y"],
258
+                    "x"=>$this->_position["x"],
259
+                    "y"=>$this->_position["y"]);
260
+    }
262 261
     
263
-  //........................................................................
262
+    //........................................................................
264 263
 
265
-  // Return the height of the margin box of the frame, in pt.  Meaningless
266
-  // unless the height has been calculated properly.
267
-  function get_margin_height() {      
264
+    // Return the height of the margin box of the frame, in pt.  Meaningless
265
+    // unless the height has been calculated properly.
266
+    function get_margin_height() {      
268 267
     return $this->_style->length_in_pt(array($this->_style->height,
269
-                                             $this->_style->margin_top,
270
-                                             $this->_style->margin_bottom,
271
-                                             $this->_style->border_top_width,
272
-                                             $this->_style->border_bottom_width,
273
-                                             $this->_style->padding_top,
274
-                                             $this->_style->padding_bottom),
275
-                                       $this->_containing_block["w"]);
276
-  }
277
-
278
-  // Return the width of the margin box of the frame, in pt.  Meaningless
279
-  // unless the width has been calculted properly.
280
-  function get_margin_width() {
268
+                                                $this->_style->margin_top,
269
+                                                $this->_style->margin_bottom,
270
+                                                $this->_style->border_top_width,
271
+                                                $this->_style->border_bottom_width,
272
+                                                $this->_style->padding_top,
273
+                                                $this->_style->padding_bottom),
274
+                                        $this->_containing_block["w"]);
275
+    }
276
+
277
+    // Return the width of the margin box of the frame, in pt.  Meaningless
278
+    // unless the width has been calculted properly.
279
+    function get_margin_width() {
281 280
     return $this->_style->length_in_pt(array($this->_style->width,
282
-                                     $this->_style->margin_left,
283
-                                     $this->_style->margin_right,
284
-                                     $this->_style->border_left_width,
285
-                                     $this->_style->border_right_width,
286
-                                     $this->_style->padding_left,
287
-                                     $this->_style->padding_right),
288
-                               $this->_containing_block["w"]);
289
-  }
290
-
291
-  // Return the padding box (x,y,w,h) of the frame
292
-  function get_padding_box() {
281
+                                        $this->_style->margin_left,
282
+                                        $this->_style->margin_right,
283
+                                        $this->_style->border_left_width,
284
+                                        $this->_style->border_right_width,
285
+                                        $this->_style->padding_left,
286
+                                        $this->_style->padding_right),
287
+                                $this->_containing_block["w"]);
288
+    }
289
+
290
+    // Return the padding box (x,y,w,h) of the frame
291
+    function get_padding_box() {
293 292
     $x = $this->_position["x"] +
294 293
       $this->_style->length_in_pt(array($this->_style->margin_left,
295 294
                                         $this->_style->border_left_width),
296
-                                  $this->_containing_block["w"]);
295
+                                    $this->_containing_block["w"]);
297 296
     $y = $this->_position["y"] +
298 297
       $this->_style->length_in_pt(array($this->_style->margin_top,
299 298
                                 $this->_style->border_top_width),
300
-                          $this->_containing_block["w"]);
299
+                            $this->_containing_block["w"]);
301 300
     
302 301
     $w = $this->_style->length_in_pt(array($this->_style->padding_left,
303
-                                   $this->_style->width,
304
-                                   $this->_style->padding_right),
305
-                             $this->_containing_block["w"]);
302
+                                    $this->_style->width,
303
+                                    $this->_style->padding_right),
304
+                                $this->_containing_block["w"]);
306 305
 
307 306
     $h = $this->_style->length_in_pt(array($this->_style->padding_top,
308
-                                   $this->_style->height,
309
-                                   $this->_style->padding_bottom),
310
-                             $this->_containing_block["w"]);
307
+                                    $this->_style->height,
308
+                                    $this->_style->padding_bottom),
309
+                                $this->_containing_block["w"]);
311 310
 
312 311
     return array(0 => $x, "x" => $x,
313
-                 1 => $y, "y" => $y,
314
-                 2 => $w, "w" => $w,
315
-                 3 => $h, "h" => $h);
316
-  }
312
+                    1 => $y, "y" => $y,
313
+                    2 => $w, "w" => $w,
314
+                    3 => $h, "h" => $h);
315
+    }
317 316
 
318
-  // Return the border box of the frame
319
-  function get_border_box() {
317
+    // Return the border box of the frame
318
+    function get_border_box() {
320 319
     $x = $this->_position["x"] +
321 320
       $this->_style->length_in_pt($this->_style->margin_left,
322
-                          $this->_containing_block["w"]);
321
+                            $this->_containing_block["w"]);
323 322
     $y = $this->_position["y"] +
324 323
       $this->_style->length_in_pt($this->_style->margin_top,
325
-                          $this->_containing_block["w"]);
324
+                            $this->_containing_block["w"]);
326 325
 
327 326
     $w = $this->_style->length_in_pt(array($this->_style->border_left_width,
328
-                                   $this->_style->padding_left,
329
-                                   $this->_style->width,
330
-                                   $this->_style->padding_right,
331
-                                   $this->_style->border_right_width),
332
-                             $this->_containing_block["w"]);
327
+                                    $this->_style->padding_left,
328
+                                    $this->_style->width,
329
+                                    $this->_style->padding_right,
330
+                                    $this->_style->border_right_width),
331
+                                $this->_containing_block["w"]);
333 332
 
334 333
     $h = $this->_style->length_in_pt(array($this->_style->border_top_width,
335
-                                   $this->_style->padding_top,
336
-                                   $this->_style->height,
337
-                                   $this->_style->padding_bottom,
338
-                                   $this->_style->border_bottom_width),
339
-                             $this->_containing_block["w"]);
334
+                                    $this->_style->padding_top,
335
+                                    $this->_style->height,
336
+                                    $this->_style->padding_bottom,
337
+                                    $this->_style->border_bottom_width),
338
+                                $this->_containing_block["w"]);
340 339
 
341 340
     return array(0 => $x, "x" => $x,
342
-                 1 => $y, "y" => $y,
343
-                 2 => $w, "w" => $w,
344
-                 3 => $h, "h" => $h);
341
+                    1 => $y, "y" => $y,
342
+                    2 => $w, "w" => $w,
343
+                    3 => $h, "h" => $h);
345 344
     
346
-  }
345
+    }
347 346
   
348
-  //........................................................................
347
+    //........................................................................
349 348
 
350
-  // Set methods
351
-  function set_id($id) {
349
+    // Set methods
350
+    function set_id($id) {
352 351
     $this->_id = $id;
353 352
 
354 353
     // We can only set attributes of DOMElement objects (nodeType == 1).
355 354
     // Since these are the only objects that we can assign CSS rules to,
356 355
     // this shortcoming is okay.
357 356
     if ( $this->_node->nodeType == 1)
358
-      $this->_node->setAttribute("frame_id", $id);
359
-  }
357
+        $this->_node->setAttribute("frame_id", $id);
358
+    }
360 359
 
361
-  function set_style(Style $style) {
360
+    function set_style(Style $style) {
362 361
     if ( is_null($this->_style) )
363
-      $this->_original_style = clone $style;
362
+        $this->_original_style = clone $style;
364 363
     
365 364
     $this->_style = $style;
366
-  }
365
+    }
367 366
   
368
-  function set_decorator(Frame_Decorator $decorator) {
367
+    function set_decorator(Frame_Decorator $decorator) {
369 368
     $this->_decorator = $decorator;
370
-  }
369
+    }
371 370
   
372
-  function set_containing_block($x = null, $y = null, $w = null, $h = null) {
371
+    function set_containing_block($x = null, $y = null, $w = null, $h = null) {
373 372
     if ( is_array($x) ){
374
-  		foreach($x AS $key => $val){
375
-			$$key = $val;
376
-		}
373
+            foreach($x AS $key => $val){
374
+            $$key = $val;
375
+        }
377 376
     }
378 377
     
379 378
     if (is_numeric($x)) {
380
-      $this->_containing_block[0] = $x;
381
-      $this->_containing_block["x"] = $x;
379
+        $this->_containing_block[0] = $x;
380
+        $this->_containing_block["x"] = $x;
382 381
     }
383 382
     
384 383
     if (is_numeric($y)) {
385
-      $this->_containing_block[1] = $y;
386
-      $this->_containing_block["y"] = $y;
384
+        $this->_containing_block[1] = $y;
385
+        $this->_containing_block["y"] = $y;
387 386
     }
388 387
     
389 388
     if (is_numeric($w)) {
390
-      $this->_containing_block[2] = $w;
391
-      $this->_containing_block["w"] = $w;
389
+        $this->_containing_block[2] = $w;
390
+        $this->_containing_block["w"] = $w;
392 391
     }
393 392
     
394 393
     if (is_numeric($h)) {
395
-      $this->_containing_block[3] = $h;
396
-      $this->_containing_block["h"] = $h;
394
+        $this->_containing_block[3] = $h;
395
+        $this->_containing_block["h"] = $h;
397 396
     }
398 397
     
399
-  }
398
+    }
400 399
 
401
-  function set_position($x = null, $y = null) {
400
+    function set_position($x = null, $y = null) {
402 401
     if ( is_array($x) )
403
-      extract($x);
402
+        extract($x);
404 403
     
405 404
     if ( is_numeric($x) ) {
406
-      $this->_position[0] = $x;
407
-      $this->_position["x"] = $x;
405
+        $this->_position[0] = $x;
406
+        $this->_position["x"] = $x;
408 407
     }
409 408
 
410 409
     if ( is_numeric($y) ) {
411
-      $this->_position[1] = $y;
412
-      $this->_position["y"] = $y;
410
+        $this->_position[1] = $y;
411
+        $this->_position["y"] = $y;
412
+    }
413 413
     }
414
-  }
415 414
 
416
-  //........................................................................
415
+    //........................................................................
417 416
 
418
-  function prepend_child(Frame $child, $update_node = true) {
417
+    function prepend_child(Frame $child, $update_node = true) {
419 418
 
420 419
     if ( $update_node ) 
421
-      $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
420
+        $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
422 421
 
423 422
     // Remove the child from its parent
424 423
     if ( $child->_parent )
425
-      $child->_parent->remove_child($child, false);
424
+        $child->_parent->remove_child($child, false);
426 425
     
427 426
     $child->_parent = $this;
428 427
     $child->_prev_sibling = null;
429 428
     
430 429
     // Handle the first child
431 430
     if ( !$this->_first_child ) {
432
-      $this->_first_child = $child;
433
-      $this->_last_child = $child;
434
-      $child->_next_sibling = null;
431
+        $this->_first_child = $child;
432
+        $this->_last_child = $child;
433
+        $child->_next_sibling = null;
435 434
       
436 435
     } else {
437 436
 
438
-      $this->_first_child->_prev_sibling = $child;
439
-      $child->_next_sibling = $this->_first_child;      
440
-      $this->_first_child = $child;
437
+        $this->_first_child->_prev_sibling = $child;
438
+        $child->_next_sibling = $this->_first_child;      
439
+        $this->_first_child = $child;
441 440
       
442 441
     }
443
-  }
442
+    }
444 443
   
445
-  function append_child(Frame $child, $update_node = true) {
444
+    function append_child(Frame $child, $update_node = true) {
446 445
 
447 446
     if ( $update_node ) 
448
-      $this->_node->appendChild($child->_node);
447
+        $this->_node->appendChild($child->_node);
449 448
 
450 449
     // Remove the child from its parent
451 450
     if ( $child->_parent )
452
-      $child->_parent->remove_child($child, false);
451
+        $child->_parent->remove_child($child, false);
453 452
 
454 453
     $child->_parent = $this;
455 454
     $child->_next_sibling = null;
456 455
     
457 456
     // Handle the first child
458 457
     if ( !$this->_last_child ) {
459
-      $this->_first_child = $child;
460
-      $this->_last_child = $child;
461
-      $child->_prev_sibling = null;
458
+        $this->_first_child = $child;
459
+        $this->_last_child = $child;
460
+        $child->_prev_sibling = null;
462 461
       
463 462
     } else {
464 463
 
465
-      $this->_last_child->_next_sibling = $child;
466
-      $child->_prev_sibling = $this->_last_child;
467
-      $this->_last_child = $child;
464
+        $this->_last_child->_next_sibling = $child;
465
+        $child->_prev_sibling = $this->_last_child;
466
+        $this->_last_child = $child;
468 467
 
469 468
     }
470
-  }  
469
+    }  
471 470
 
472
-  // Inserts a new child immediately before the specified frame
473
-  function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
471
+    // Inserts a new child immediately before the specified frame
472
+    function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
474 473
 
475 474
     if ( $ref === $this->_first_child ) {
476
-      $this->prepend_child($new_child, $update_node);
477
-      return;
475
+        $this->prepend_child($new_child, $update_node);
476
+        return;
478 477
     }
479 478
 
480 479
     if ( is_null($ref) ) {
481
-      $this->append_child($new_child, $update_node);
482
-      return;
480
+        $this->append_child($new_child, $update_node);
481
+        return;
483 482
     }
484 483
     
485 484
     if ( $ref->_parent !== $this )
486
-      throw new DOMPDF_Exception("Reference child is not a child of this node.");
485
+        throw new DOMPDF_Exception("Reference child is not a child of this node.");
487 486
 
488 487
     // Update the node    
489 488
     if ( $update_node )
490
-      $this->_node->insertBefore($new_child->_node, $ref->_node);
489
+        $this->_node->insertBefore($new_child->_node, $ref->_node);
491 490
 
492 491
     // Remove the child from its parent
493 492
     if ( $new_child->_parent )
494
-      $new_child->_parent->remove_child($new_child, false);
493
+        $new_child->_parent->remove_child($new_child, false);
495 494
     
496 495
     $new_child->_parent = $this;
497 496
     $new_child->_next_sibling = $ref;
498 497
     $new_child->_prev_sibling = $ref->_prev_sibling;
499 498
 
500 499
     if ( $ref->_prev_sibling )
501
-      $ref->_prev_sibling->_next_sibling = $new_child;
500
+        $ref->_prev_sibling->_next_sibling = $new_child;
502 501
     
503 502
     $ref->_prev_sibling = $new_child;
504
-  }
503
+    }
505 504
   
506
-  // Inserts a new child immediately after the specified frame
507
-  function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {    
505
+    // Inserts a new child immediately after the specified frame
506
+    function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {    
508 507
 
509 508
     if ( $ref === $this->_last_child ) {
510
-      $this->append_child($new_child, $update_node);
511
-      return;
509
+        $this->append_child($new_child, $update_node);
510
+        return;
512 511
     }
513 512
 
514 513
     if ( is_null($ref) ) {
515
-      $this->prepend_child($new_child, $update_node);
516
-      return;
514
+        $this->prepend_child($new_child, $update_node);
515
+        return;
517 516
     }
518 517
     
519 518
     if ( $ref->_parent !== $this )
520
-      throw new DOMPDF_Exception("Reference child is not a child of this node.");
519
+        throw new DOMPDF_Exception("Reference child is not a child of this node.");
521 520
 
522 521
     // Update the node
523 522
     if ( $update_node ) {
524
-      if ( $ref->_next_sibling ) {
523
+        if ( $ref->_next_sibling ) {
525 524
         $next_node = $ref->_next_sibling->_node;
526 525
         $this->_node->insertBefore($new_child->_node, $next_node);
527
-      } else {
526
+        } else {
528 527
         $new_child->_node = $this->_node->appendChild($new_child);
529
-      }
528
+        }
530 529
     }
531 530
     
532 531
     // Remove the child from its parent
533 532
     if ( $new_child->_parent)
534
-      $new_child->_parent->remove_child($new_child, false);
533
+        $new_child->_parent->remove_child($new_child, false);
535 534
     
536 535
     $new_child->_parent = $this;
537 536
     $new_child->_prev_sibling = $ref;
538 537
     $new_child->_next_sibling = $ref->_next_sibling;
539 538
 
540 539
     if ( $ref->_next_sibling ) 
541
-      $ref->_next_sibling->_prev_sibling = $new_child;
540
+        $ref->_next_sibling->_prev_sibling = $new_child;
542 541
 
543 542
     $ref->_next_sibling = $new_child;
544
-  }
543
+    }
545 544
 
546 545
 
547
-  function remove_child(Frame $child, $update_node = true) {
546
+    function remove_child(Frame $child, $update_node = true) {
548 547
 
549 548
     if ( $child->_parent !== $this )
550
-      throw new DOMPDF_Exception("Child not found in this frame");
549
+        throw new DOMPDF_Exception("Child not found in this frame");
551 550
 
552 551
     if ( $update_node )
553
-      $this->_node->removeChild($child->_node);
552
+        $this->_node->removeChild($child->_node);
554 553
     
555 554
     if ( $child === $this->_first_child )
556
-      $this->_first_child = $child->_next_sibling;
555
+        $this->_first_child = $child->_next_sibling;
557 556
 
558 557
     if ( $child === $this->_last_child )
559
-      $this->_last_child = $child->_prev_sibling;
558
+        $this->_last_child = $child->_prev_sibling;
560 559
 
561 560
     if ( $child->_prev_sibling )
562
-      $child->_prev_sibling->_next_sibling = $child->_next_sibling;
561
+        $child->_prev_sibling->_next_sibling = $child->_next_sibling;
563 562
 
564 563
     if ( $child->_next_sibling )
565
-      $child->_next_sibling->_prev_sibling = $child->_prev_sibling;    
564
+        $child->_next_sibling->_prev_sibling = $child->_prev_sibling;    
566 565
 
567 566
     $child->_next_sibling = null;
568 567
     $child->_prev_sibling = null;
569 568
     $child->_parent = null;
570 569
     return $child;
571 570
         
572
-  }
571
+    }
573 572
 
574
-  //........................................................................
573
+    //........................................................................
575 574
 
576
-  // Debugging function:
577
-  function __toString() {
575
+    // Debugging function:
576
+    function __toString() {
578 577
 
579 578
     // Skip empty text frames
580 579
 //     if ( $this->_node->nodeName === "#text" &&
@@ -588,29 +587,29 @@  discard block
 block discarded – undo
588 587
     $str .= "Class: " .get_class($this) . "<br/>";
589 588
     
590 589
     if ( $this->_node->nodeName === "#text" ) {
591
-      $tmp = htmlspecialchars($this->_node->nodeValue);
592
-      $str .= "<pre>'" .  mb_substr($tmp,0,70) .
590
+        $tmp = htmlspecialchars($this->_node->nodeValue);
591
+        $str .= "<pre>'" .  mb_substr($tmp,0,70) .
593 592
         (mb_strlen($tmp) > 70 ? "..." : "") . "'</pre>";
594 593
     }
595 594
     if ( $this->_parent )
596
-      $str .= "\nParent:" . $this->_parent->_node->nodeName .
595
+        $str .= "\nParent:" . $this->_parent->_node->nodeName .
597 596
         " (" . spl_object_hash($this->_parent->_node) . ") " .
598 597
         "<br/>";
599 598
 
600 599
     if ( $this->_prev_sibling )
601
-      $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
600
+        $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
602 601
         " (" . spl_object_hash($this->_prev_sibling->_node) . ") " .
603 602
         "<br/>";
604 603
 
605 604
     if ( $this->_next_sibling )
606
-      $str .= "Next: " . $this->_next_sibling->_node->nodeName .
605
+        $str .= "Next: " . $this->_next_sibling->_node->nodeName .
607 606
         " (" . spl_object_hash($this->_next_sibling->_node) . ") " .
608 607
         "<br/>";
609 608
 
610 609
     $d = $this->get_decorator();
611 610
     while ($d && $d != $d->get_decorator()) {
612
-      $str .= "Decorator: " . get_class($d) . "<br/>";
613
-      $d = $d->get_decorator();
611
+        $str .= "Decorator: " . get_class($d) . "<br/>";
612
+        $d = $d->get_decorator();
614 613
     }
615 614
 
616 615
     $str .= "Position: " . pre_r($this->_position, true);
@@ -621,33 +620,33 @@  discard block
 block discarded – undo
621 620
     $str .= "\nStyle: <pre>". $this->_style->__toString() . "</pre>";
622 621
 
623 622
     if ( $this->_decorator instanceof Block_Frame_Decorator ) {
624
-      $str .= "Lines:<pre>";
625
-      foreach ($this->_decorator->get_lines() as $line) {
623
+        $str .= "Lines:<pre>";
624
+        foreach ($this->_decorator->get_lines() as $line) {
626 625
         foreach ($line["frames"] as $frame) {
627
-          if ($frame instanceof Text_Frame_Decorator) {
626
+            if ($frame instanceof Text_Frame_Decorator) {
628 627
             $str .= "\ntext: ";          
629 628
             $str .= "'". htmlspecialchars($frame->get_text()) ."'";
630
-          } else {
629
+            } else {
631 630
             $str .= "\nBlock: " . $frame->get_node()->nodeName . " (" . spl_object_hash($frame->get_node()) . ")";
632
-          }
631
+            }
633 632
         }
634 633
         
635 634
         $str .=
636
-          //"\ncount => " . $line["count"] . "\n".
637
-          "\ny => " . $line["y"] . "\n" .
638
-          "w => " . $line["w"] . "\n" .
639
-          "h => " . $line["h"] . "\n";
640
-      }
641
-      $str .= "</pre>";
635
+            //"\ncount => " . $line["count"] . "\n".
636
+            "\ny => " . $line["y"] . "\n" .
637
+            "w => " . $line["w"] . "\n" .
638
+            "h => " . $line["h"] . "\n";
639
+        }
640
+        $str .= "</pre>";
642 641
     }
643 642
     $str .= "\n";
644 643
     if ( php_sapi_name() === "cli" )
645
-      $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
644
+        $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
646 645
                                     array("\n","",""),
647 646
                                     $str));
648 647
     
649 648
     return $str;
650
-  }
649
+    }
651 650
         
652 651
 }
653 652
 
@@ -660,10 +659,10 @@  discard block
 block discarded – undo
660 659
  * @package dompdf
661 660
  */
662 661
 class FrameList implements IteratorAggregate {
663
-  protected $_frame;
662
+    protected $_frame;
664 663
 
665
-  function __construct($frame) { $this->_frame = $frame; }
666
-  function getIterator() { return new FrameListIterator($this->_frame); }
664
+    function __construct($frame) { $this->_frame = $frame; }
665
+    function getIterator() { return new FrameListIterator($this->_frame); }
667 666
 }
668 667
   
669 668
 /**
@@ -677,37 +676,37 @@  discard block
 block discarded – undo
677 676
  */
678 677
 class FrameListIterator implements Iterator {
679 678
 
680
-  protected $_parent;
681
-  protected $_cur;
682
-  protected $_num;
679
+    protected $_parent;
680
+    protected $_cur;
681
+    protected $_num;
683 682
 
684
-  function __construct(Frame $frame) {
683
+    function __construct(Frame $frame) {
685 684
     $this->_parent = $frame;
686 685
     $this->_cur = $frame->get_first_child();
687 686
     $this->_num = 0;
688
-  }
687
+    }
689 688
 
690
-  function rewind() { 
689
+    function rewind() { 
691 690
     $this->_cur = $this->_parent->get_first_child();
692 691
     $this->_num = 0;
693
-  }
692
+    }
694 693
 
695
-  function valid() {
694
+    function valid() {
696 695
     return isset($this->_cur);// && ($this->_cur->get_prev_sibling() === $this->_prev);
697
-  }
698
-  function key() { return $this->_num; }
699
-  function current() { return $this->_cur; }
696
+    }
697
+    function key() { return $this->_num; }
698
+    function current() { return $this->_cur; }
700 699
 
701
-  function next() {
700
+    function next() {
702 701
 
703 702
     $ret = $this->_cur;
704 703
     if ( !$ret )
705
-      return null;
704
+        return null;
706 705
     
707 706
     $this->_cur = $this->_cur->get_next_sibling();
708 707
     $this->_num++;
709 708
     return $ret;
710
-  }
709
+    }
711 710
 }
712 711
 
713 712
 //------------------------------------------------------------------------
@@ -720,9 +719,9 @@  discard block
 block discarded – undo
720 719
  */
721 720
 class FrameTreeList implements IteratorAggregate {
722 721
 
723
-  protected $_root;
724
-  function __construct(Frame $root) { $this->_root = $root; }
725
-  function getIterator() { return new FrameTreeIterator($this->_root); }
722
+    protected $_root;
723
+    function __construct(Frame $root) { $this->_root = $root; }
724
+    function getIterator() { return new FrameTreeIterator($this->_root); }
726 725
 
727 726
 }
728 727
 
@@ -736,25 +735,25 @@  discard block
 block discarded – undo
736 735
  */
737 736
 class FrameTreeIterator implements Iterator {
738 737
 
739
-  protected $_root;
740
-  protected $_stack = array();
741
-  protected $_num;
738
+    protected $_root;
739
+    protected $_stack = array();
740
+    protected $_num;
742 741
   
743
-  function __construct(Frame $root) {
742
+    function __construct(Frame $root) {
744 743
     $this->_stack[] = $this->_root = $root;
745 744
     $this->_num = 0;
746
-  }
745
+    }
747 746
 
748
-  function rewind() {
747
+    function rewind() {
749 748
     $this->_stack = array($this->_root);
750 749
     $this->_num = 0;
751
-  }
750
+    }
752 751
     
753
-  function valid() { return count($this->_stack) > 0; }
754
-  function key() { return $this->_num; }
755
-  function current() { return end($this->_stack); }
752
+    function valid() { return count($this->_stack) > 0; }
753
+    function key() { return $this->_num; }
754
+    function current() { return end($this->_stack); }
756 755
 
757
-  function next() {
756
+    function next() {
758 757
     $b = end($this->_stack);
759 758
     
760 759
     // Pop last element
@@ -763,10 +762,10 @@  discard block
 block discarded – undo
763 762
     
764 763
     // Push all children onto the stack in reverse order
765 764
     if ( $c = $b->get_last_child() ) {
766
-      $this->_stack[] = $c;
767
-      while ( $c = $c->get_prev_sibling() )
765
+        $this->_stack[] = $c;
766
+        while ( $c = $c->get_prev_sibling() )
768 767
         $this->_stack[] = $c;
769 768
     }
770 769
     return $b;
771
-  }
770
+    }
772 771
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/page_cache.cls.php 1 patch
Indentation   +70 added lines, -71 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_cache.cls.php,v $
6
- * Created on: 2004-07-23
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: page_cache.cls.php,v $
6
+     * Created on: 2004-07-23
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: page_cache.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -50,59 +49,59 @@  discard block
 block discarded – undo
50 49
  */
51 50
 class Page_Cache {
52 51
 
53
-  const DB_USER = "dompdf_page_cache";
54
-  const DB_PASS = "some meaningful password";
55
-  const DB_NAME = "dompdf_page_cache";
52
+    const DB_USER = "dompdf_page_cache";
53
+    const DB_PASS = "some meaningful password";
54
+    const DB_NAME = "dompdf_page_cache";
56 55
   
57
-  static private $__connection = null;
56
+    static private $__connection = null;
58 57
   
59
-  function init() {
58
+    function init() {
60 59
     if ( is_null(self::$__connection) ) {
61
-      $con_str = "host=" . DB_HOST .
60
+        $con_str = "host=" . DB_HOST .
62 61
         " dbname=" . self::DB_NAME .
63 62
         " user=" . self::DB_USER .
64 63
         " password=" . self::DB_PASS;
65 64
       
66
-      if ( !self::$__connection = pg_connect($con_str) )
65
+        if ( !self::$__connection = pg_connect($con_str) )
67 66
         throw new Exception("Database connection failed.");
68 67
     }
69
-  }
68
+    }
70 69
   
71
-  function __construct() { throw new Exception("Can not create instance of Page_Class.  Class is static."); }
70
+    function __construct() { throw new Exception("Can not create instance of Page_Class.  Class is static."); }
72 71
 
73
-  private static function __query($sql) {
72
+    private static function __query($sql) {
74 73
     if ( !($res = pg_query(self::$__connection, $sql)) )
75
-      throw new Exception(pg_last_error(self::$__connection));
74
+        throw new Exception(pg_last_error(self::$__connection));
76 75
     return $res;
77
-  }
76
+    }
78 77
   
79
-  static function store_page($id, $page_num, $data) {
78
+    static function store_page($id, $page_num, $data) {
80 79
     $where = "WHERE id='" . pg_escape_string($id) . "' AND ".
81
-      "page_num=". pg_escape_string($page_num);
80
+        "page_num=". pg_escape_string($page_num);
82 81
 
83 82
     $res = self::__query("SELECT timestamp FROM page_cache ". $where);
84 83
 
85 84
     $row = pg_fetch_assoc($res);
86 85
     
87 86
     if ( $row ) 
88
-      self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
87
+        self::__query("UPDATE page_cache SET data='" . pg_escape_string($data) . "' " . $where);
89 88
     else 
90
-      self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
91
-                     pg_escape_string($page_num) . ", ".
92
-                     "'". pg_escape_string($data) . "')");
89
+        self::__query("INSERT INTO page_cache (id, page_num, data) VALUES ('" . pg_escape_string($id) . "', ".
90
+                        pg_escape_string($page_num) . ", ".
91
+                        "'". pg_escape_string($data) . "')");
93 92
 
94
-  }
93
+    }
95 94
 
96
-  static function store_fonts($id, $fonts) {
95
+    static function store_fonts($id, $fonts) {
97 96
     self::__query("BEGIN");
98 97
     // Update the font information
99 98
     self::__query("DELETE FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
100 99
 
101 100
     foreach (array_keys($fonts) as $font)
102
-      self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
101
+        self::__query("INSERT INTO page_fonts (id, font_name) VALUES ('" .
103 102
                     pg_escape_string($id) . "', '" . pg_escape_string($font) . "')");
104 103
     self::__query("COMMIT");
105
-  }
104
+    }
106 105
   
107 106
 //   static function retrieve_page($id, $page_num) {
108 107
 
@@ -115,45 +114,45 @@  discard block
 block discarded – undo
115 114
     
116 115
 //   }
117 116
 
118
-  static function get_page_timestamp($id, $page_num) {
117
+    static function get_page_timestamp($id, $page_num) {
119 118
     $res = self::__query("SELECT timestamp FROM page_cache WHERE id='" . pg_escape_string($id) . "' AND ".
120
-                          "page_num=". pg_escape_string($page_num));
119
+                            "page_num=". pg_escape_string($page_num));
121 120
 
122 121
     $row = pg_fetch_assoc($res);
123 122
 
124 123
     return $row["timestamp"];
125 124
     
126
-  }
125
+    }
127 126
 
128
-  // Adds the cached document referenced by $id to the provided pdf
129
-  static function insert_cached_document(CPDF_Adapter $pdf, $id, $new_page = true) {
127
+    // Adds the cached document referenced by $id to the provided pdf
128
+    static function insert_cached_document(CPDF_Adapter $pdf, $id, $new_page = true) {
130 129
     $res = self::__query("SELECT font_name FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");
131 130
 
132 131
     // Ensure that the fonts needed by the cached document are loaded into
133 132
     // the pdf
134 133
     while ($row = pg_fetch_assoc($res)) 
135
-      $pdf->get_cpdf()->selectFont($row["font_name"]);
134
+        $pdf->get_cpdf()->selectFont($row["font_name"]);
136 135
     
137 136
     $res = self::__query("SELECT data FROM page_cache WHERE id='" . pg_escape_string($id) . "'");
138 137
 
139 138
     if ( $new_page )
140
-      $pdf->new_page();
139
+        $pdf->new_page();
141 140
 
142 141
     $first = true;
143 142
     while ($row = pg_fetch_assoc($res)) {
144 143
 
145
-      if ( !$first ) 
144
+        if ( !$first ) 
146 145
         $pdf->new_page();
147
-      else 
146
+        else 
148 147
         $first = false;        
149 148
       
150
-      $page = $pdf->reopen_serialized_object($row["data"]);
151
-      //$pdf->close_object();
152
-      $pdf->add_object($page, "add");
149
+        $page = $pdf->reopen_serialized_object($row["data"]);
150
+        //$pdf->close_object();
151
+        $pdf->add_object($page, "add");
153 152
 
154 153
     }
155 154
       
156
-  }
155
+    }
157 156
 }
158 157
 
159 158
 Page_Cache::init();
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/table_row_positioner.cls.php 1 patch
Indentation   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: table_row_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
@@ -47,22 +46,22 @@  discard block
 block discarded – undo
47 46
  */
48 47
 class Table_Row_Positioner extends Positioner {
49 48
 
50
-  function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
49
+    function __construct(Frame_Decorator $frame) { parent::__construct($frame); }
51 50
   
52
-  //........................................................................
51
+    //........................................................................
53 52
 
54
-  function position() {
53
+    function position() {
55 54
 
56 55
     $cb = $this->_frame->get_containing_block();    
57 56
     $p = $this->_frame->get_prev_sibling();
58 57
 
59 58
     if ( $p ) 
60
-      $y = $p->get_position("y") + $p->get_margin_height();
59
+        $y = $p->get_position("y") + $p->get_margin_height();
61 60
 
62 61
     else
63
-      $y = $cb["y"];
62
+        $y = $cb["y"];
64 63
 
65 64
     $this->_frame->set_position($cb["x"], $y);
66 65
 
67
-  }
66
+    }
68 67
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/cached_pdf_decorator.cls.php 1 patch
Indentation   +96 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,41 +1,40 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * DOMPDF - PHP5 HTML to PDF renderer
4
- *
5
- * File: $RCSfile: cached_pdf_decorator.cls.php,v $
6
- * Created on: 2004-07-23
7
- *
8
- * Copyright (c) 2004 - Benj Carson <[email protected]>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 2.1 of the License, or (at your option) any later version.
14
- *
15
- * This library is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public License
21
- * along with this library in the file LICENSE.LGPL; if not, write to the
22
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
- * 02111-1307 USA
24
- *
25
- * Alternatively, you may distribute this software under the terms of the
26
- * PHP License, version 3.0 or later.  A copy of this license should have
27
- * been distributed with this file in the file LICENSE.PHP .  If this is not
28
- * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
- *
30
- * The latest version of DOMPDF might be available at:
31
- * http://www.dompdf.com/
32
- *
33
- * @link http://www.dompdf.com/
34
- * @copyright 2004 Benj Carson
35
- * @author Benj Carson <[email protected]>
36
- * @package dompdf
37
-
38
- */
3
+     * DOMPDF - PHP5 HTML to PDF renderer
4
+     *
5
+     * File: $RCSfile: cached_pdf_decorator.cls.php,v $
6
+     * Created on: 2004-07-23
7
+     *
8
+     * Copyright (c) 2004 - Benj Carson <[email protected]>
9
+     *
10
+     * This library is free software; you can redistribute it and/or
11
+     * modify it under the terms of the GNU Lesser General Public
12
+     * License as published by the Free Software Foundation; either
13
+     * version 2.1 of the License, or (at your option) any later version.
14
+     *
15
+     * This library is distributed in the hope that it will be useful,
16
+     * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+     * Lesser General Public License for more details.
19
+     *
20
+     * You should have received a copy of the GNU Lesser General Public License
21
+     * along with this library in the file LICENSE.LGPL; if not, write to the
22
+     * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23
+     * 02111-1307 USA
24
+     *
25
+     * Alternatively, you may distribute this software under the terms of the
26
+     * PHP License, version 3.0 or later.  A copy of this license should have
27
+     * been distributed with this file in the file LICENSE.PHP .  If this is not
28
+     * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29
+     *
30
+     * The latest version of DOMPDF might be available at:
31
+     * http://www.dompdf.com/
32
+     *
33
+     * @link http://www.dompdf.com/
34
+     * @copyright 2004 Benj Carson
35
+     * @author Benj Carson <[email protected]>
36
+     * @package dompdf
37
+     */
39 38
 
40 39
 /* $Id: cached_pdf_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */
41 40
 
@@ -53,90 +52,90 @@  discard block
 block discarded – undo
53 52
  * @package dompdf
54 53
  */
55 54
 class Cached_PDF_Decorator extends CPDF_Adapter implements Canvas {
56
-  protected $_pdf;
57
-  protected $_cache_id;
58
-  protected $_current_page_id;
59
-  protected $_fonts;  // fonts used in this document
55
+    protected $_pdf;
56
+    protected $_cache_id;
57
+    protected $_current_page_id;
58
+    protected $_fonts;  // fonts used in this document
60 59
   
61
-  function __construct($cache_id, CPDF_Adapter $pdf) {
60
+    function __construct($cache_id, CPDF_Adapter $pdf) {
62 61
     $this->_pdf = $pdf;
63 62
     $this->_cache_id = $cache_id;
64 63
     $this->_fonts = array();
65 64
     
66 65
     $this->_current_page_id = $this->_pdf->open_object();
67
-  }
66
+    }
68 67
 
69
-  //........................................................................
68
+    //........................................................................
70 69
 
71
-  function get_cpdf() { return $this->_pdf->get_cpdf(); }
70
+    function get_cpdf() { return $this->_pdf->get_cpdf(); }
72 71
 
73
-  function open_object() { $this->_pdf->open_object(); }
74
-  function reopen_object() { return $this->_pdf->reopen_object(); }
72
+    function open_object() { $this->_pdf->open_object(); }
73
+    function reopen_object() { return $this->_pdf->reopen_object(); }
75 74
   
76
-  function close_object() { $this->_pdf->close_object(); }
75
+    function close_object() { $this->_pdf->close_object(); }
77 76
 
78
-  function add_object($object, $where = 'all') { $this->_pdf->add_object($object, $where); }
77
+    function add_object($object, $where = 'all') { $this->_pdf->add_object($object, $where); }
79 78
 
80
-  function serialize_object($id) { $this->_pdf->serialize_object($id); }
79
+    function serialize_object($id) { $this->_pdf->serialize_object($id); }
81 80
 
82
-  function reopen_serialized_object($obj) { $this->_pdf->reopen_serialized_object($obj); }
81
+    function reopen_serialized_object($obj) { $this->_pdf->reopen_serialized_object($obj); }
83 82
     
84
-  //........................................................................
83
+    //........................................................................
85 84
 
86
-  function get_width() { return $this->_pdf->get_width(); }
87
-  function get_height() {  return $this->_pdf->get_height(); }
88
-  function get_page_number() { return $this->_pdf->get_page_number(); }
89
-  function get_page_count() { return $this->_pdf->get_page_count(); }
85
+    function get_width() { return $this->_pdf->get_width(); }
86
+    function get_height() {  return $this->_pdf->get_height(); }
87
+    function get_page_number() { return $this->_pdf->get_page_number(); }
88
+    function get_page_count() { return $this->_pdf->get_page_count(); }
90 89
 
91
-  function set_page_number($num) { $this->_pdf->set_page_number($num); }
92
-  function set_page_count($count) { $this->_pdf->set_page_count($count); }
90
+    function set_page_number($num) { $this->_pdf->set_page_number($num); }
91
+    function set_page_count($count) { $this->_pdf->set_page_count($count); }
93 92
 
94
-  function line($x1, $y1, $x2, $y2, $color, $width, $style = array()) {
93
+    function line($x1, $y1, $x2, $y2, $color, $width, $style = array()) {
95 94
     $this->_pdf->line($x1, $y1, $x2, $y2, $color, $width, $style);
96
-  }
95
+    }
97 96
                               
98
-  function rectangle($x1, $y1, $w, $h, $color, $width, $style = array()) {
97
+    function rectangle($x1, $y1, $w, $h, $color, $width, $style = array()) {
99 98
     $this->_pdf->rectangle($x1, $y1, $w, $h, $color, $width, $style);
100
-  }
99
+    }
101 100
  
102
-  function filled_rectangle($x1, $y1, $w, $h, $color) {
101
+    function filled_rectangle($x1, $y1, $w, $h, $color) {
103 102
     $this->_pdf->filled_rectangle($x1, $y1, $w, $h, $color);
104
-  }
103
+    }
105 104
     
106
-  function polygon($points, $color, $width = null, $style = array(), $fill = false) {
105
+    function polygon($points, $color, $width = null, $style = array(), $fill = false) {
107 106
     $this->_pdf->polygon($points, $color, $width, $style, $fill);
108
-  }
107
+    }
109 108
 
110
-  function circle($x, $y, $r1, $color, $width = null, $style = null, $fill = false) {
109
+    function circle($x, $y, $r1, $color, $width = null, $style = null, $fill = false) {
111 110
     $this->_pdf->circle($x, $y, $r1, $color, $width, $style, $fill);
112
-  }
111
+    }
113 112
 
114
-  function image($img_url, $x, $y, $w = null, $h = null) {
113
+    function image($img_url, $x, $y, $w = null, $h = null) {
115 114
     $this->_pdf->image($img_url, $x, $y, $w, $h);
116
-  }
115
+    }
117 116
   
118
-  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
117
+    function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
119 118
     $this->_fonts[$font] = true;
120 119
     $this->_pdf->text($x, $y, $text, $font, $size, $color, $adjust, $angle);
121
-  }
120
+    }
122 121
 
123
-  function page_text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
122
+    function page_text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0, $angle = 0) {
124 123
     
125 124
     // We want to remove this from cached pages since it may not be correct
126 125
     $this->_pdf->close_object();
127 126
     $this->_pdf->page_text($x, $y, $text, $font, $size, $color, $adjust, $angle);
128 127
     $this->_pdf->reopen_object($this->_current_page_id);
129
-  }
128
+    }
130 129
   
131
-  function page_script($script, $type = 'text/php') {
130
+    function page_script($script, $type = 'text/php') {
132 131
     
133 132
     // We want to remove this from cached pages since it may not be correct
134 133
     $this->_pdf->close_object();
135 134
     $this->_pdf->page_script($script, $type);
136 135
     $this->_pdf->reopen_object($this->_current_page_id);
137
-  }
136
+    }
138 137
   
139
-  function new_page() {
138
+    function new_page() {
140 139
     $this->_pdf->close_object();
141 140
 
142 141
     // Add the object to the current page
@@ -144,43 +143,43 @@  discard block
 block discarded – undo
144 143
     $this->_pdf->new_page();    
145 144
 
146 145
     Page_Cache::store_page($this->_cache_id,
147
-                           $this->_pdf->get_page_number() - 1,
148
-                           $this->_pdf->serialize_object($this->_current_page_id));
146
+                            $this->_pdf->get_page_number() - 1,
147
+                            $this->_pdf->serialize_object($this->_current_page_id));
149 148
 
150 149
     $this->_current_page_id = $this->_pdf->open_object();
151 150
     return $this->_current_page_id;
152
-  }
151
+    }
153 152
   
154
-  function stream($filename) {
153
+    function stream($filename) {
155 154
     // Store the last page in the page cache
156 155
     if ( !is_null($this->_current_page_id) ) {
157
-      $this->_pdf->close_object();
158
-      $this->_pdf->add_object($this->_current_page_id, "add");
159
-      Page_Cache::store_page($this->_cache_id,
160
-                             $this->_pdf->get_page_number(),
161
-                             $this->_pdf->serialize_object($this->_current_page_id));
162
-      Page_Cache::store_fonts($this->_cache_id, $this->_fonts);
163
-      $this->_current_page_id = null;
156
+        $this->_pdf->close_object();
157
+        $this->_pdf->add_object($this->_current_page_id, "add");
158
+        Page_Cache::store_page($this->_cache_id,
159
+                                $this->_pdf->get_page_number(),
160
+                                $this->_pdf->serialize_object($this->_current_page_id));
161
+        Page_Cache::store_fonts($this->_cache_id, $this->_fonts);
162
+        $this->_current_page_id = null;
164 163
     }
165 164
     
166 165
     $this->_pdf->stream($filename);
167 166
     
168
-  }
167
+    }
169 168
   
170
-  function &output() {
169
+    function &output() {
171 170
     // Store the last page in the page cache
172 171
     if ( !is_null($this->_current_page_id) ) {
173
-      $this->_pdf->close_object();
174
-      $this->_pdf->add_object($this->_current_page_id, "add");
175
-      Page_Cache::store_page($this->_cache_id,
176
-                             $this->_pdf->get_page_number(),
177
-                             $this->_pdf->serialize_object($this->_current_page_id));
178
-      $this->_current_page_id = null;
172
+        $this->_pdf->close_object();
173
+        $this->_pdf->add_object($this->_current_page_id, "add");
174
+        Page_Cache::store_page($this->_cache_id,
175
+                                $this->_pdf->get_page_number(),
176
+                                $this->_pdf->serialize_object($this->_current_page_id));
177
+        $this->_current_page_id = null;
179 178
     }
180 179
     
181 180
     return $this->_pdf->output();
182
-  }
181
+    }
183 182
   
184
-  function get_messages() { return $this->_pdf->get_messages(); }
183
+    function get_messages() { return $this->_pdf->get_messages(); }
185 184
   
186 185
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/tcpdf_adapter.cls.php 1 patch
Indentation   +328 added lines, -329 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
  * @copyright 2004 Benj Carson
35 35
  * @author Benj Carson <[email protected]>
36 36
  * @package dompdf
37
-
38 37
  */
39 38
 
40 39
 /* $Id: tcpdf_adapter.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */
@@ -57,98 +56,98 @@  discard block
 block discarded – undo
57 56
  */
58 57
 class TCPDF_Adapter implements Canvas {
59 58
 
60
-  /**
61
-   * Dimensions of paper sizes in points
62
-   *
63
-   * @var array;
64
-   */
65
-  static public $PAPER_SIZES = array(); // Set to
59
+    /**
60
+     * Dimensions of paper sizes in points
61
+     *
62
+     * @var array;
63
+     */
64
+    static public $PAPER_SIZES = array(); // Set to
66 65
                                         // CPDF_Adapter::$PAPER_SIZES below.
67 66
 
68 67
 
69
-  /**
70
-   * Instance of the TCPDF class
71
-   *
72
-   * @var TCPDF
73
-   */
74
-  private $_pdf;
75
-
76
-  /**
77
-   * PDF width in points
78
-   *
79
-   * @var float
80
-   */
81
-  private $_width;
82
-
83
-  /**
84
-   * PDF height in points
85
-   *
86
-   * @var float
87
-   */
88
-  private $_height;
89
-
90
-  /**
91
-   * Last fill colour used
92
-   *
93
-   * @var array
94
-   */
95
-  private $_last_fill_color;
96
-
97
-  /**
98
-   * Last stroke colour used
99
-   *
100
-   * @var array
101
-   */
102
-  private $_last_stroke_color;
103
-
104
-  /**
105
-   * Last line width used
106
-   *
107
-   * @var float
108
-   */
109
-  private $_last_line_width;
68
+    /**
69
+     * Instance of the TCPDF class
70
+     *
71
+     * @var TCPDF
72
+     */
73
+    private $_pdf;
74
+
75
+    /**
76
+     * PDF width in points
77
+     *
78
+     * @var float
79
+     */
80
+    private $_width;
81
+
82
+    /**
83
+     * PDF height in points
84
+     *
85
+     * @var float
86
+     */
87
+    private $_height;
88
+
89
+    /**
90
+     * Last fill colour used
91
+     *
92
+     * @var array
93
+     */
94
+    private $_last_fill_color;
95
+
96
+    /**
97
+     * Last stroke colour used
98
+     *
99
+     * @var array
100
+     */
101
+    private $_last_stroke_color;
102
+
103
+    /**
104
+     * Last line width used
105
+     *
106
+     * @var float
107
+     */
108
+    private $_last_line_width;
110 109
   
111
-  /**
112
-   * Total number of pages
113
-   *
114
-   * @var int
115
-   */
116
-  private $_page_count;
117
-
118
-  /**
119
-   * Text to display on every page
120
-   *
121
-   * @var array
122
-   */
123
-  private $_page_text;
124
-
125
-  /**
126
-   * Array of pages for accessing after initial rendering is complete
127
-   *
128
-   * @var array
129
-   */
130
-  private $_pages;
131
-
132
-  /**
133
-   * Class constructor
134
-   *
135
-   * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
136
-   *                     an array(xmin,ymin,xmax,ymax)
137
-   * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
138
-   */
139
-  function __construct($paper = "letter", $orientation = "portrait") {
110
+    /**
111
+     * Total number of pages
112
+     *
113
+     * @var int
114
+     */
115
+    private $_page_count;
116
+
117
+    /**
118
+     * Text to display on every page
119
+     *
120
+     * @var array
121
+     */
122
+    private $_page_text;
123
+
124
+    /**
125
+     * Array of pages for accessing after initial rendering is complete
126
+     *
127
+     * @var array
128
+     */
129
+    private $_pages;
130
+
131
+    /**
132
+     * Class constructor
133
+     *
134
+     * @param mixed $paper The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
135
+     *                     an array(xmin,ymin,xmax,ymax)
136
+     * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
137
+     */
138
+    function __construct($paper = "letter", $orientation = "portrait") {
140 139
    
141 140
     if ( is_array($paper) )
142
-      $size = $paper;
141
+        $size = $paper;
143 142
     else if ( isset(self::$PAPER_SIZES[mb_strtolower($paper)]) )
144
-      $size = self::$PAPER_SIZE[$paper];
143
+        $size = self::$PAPER_SIZE[$paper];
145 144
     else
146
-      $size = self::$PAPER_SIZE["letter"];
145
+        $size = self::$PAPER_SIZE["letter"];
147 146
 
148 147
     if ( mb_strtolower($orientation) === "landscape" ) {
149
-      $a = $size[3];
150
-      $size[3] = $size[2];
151
-      $size[2] = $a;
148
+        $a = $size[3];
149
+        $size[3] = $size[2];
150
+        $size[2] = $a;
152 151
     }
153 152
 
154 153
     $this->_width = $size[2] - $size[0];
@@ -163,135 +162,135 @@  discard block
 block discarded – undo
163 162
     $this->_page_text = array();
164 163
 
165 164
     $this->_last_fill_color     =
166
-      $this->_last_stroke_color =
167
-      $this->_last_line_width   = null;
165
+        $this->_last_stroke_color =
166
+        $this->_last_line_width   = null;
168 167
 
169
-  }  
168
+    }  
170 169
   
171
-  /**
172
-   * Remaps y coords from 4th to 1st quadrant
173
-   *
174
-   * @param float $y
175
-   * @return float
176
-   */
177
-  protected function y($y) { return $this->_height - $y; }
178
-
179
-  /**
180
-   * Sets the stroke colour
181
-   *
182
-   * @param array $color
183
-   */
184
-  protected function _set_stroke_colour($colour) {
170
+    /**
171
+     * Remaps y coords from 4th to 1st quadrant
172
+     *
173
+     * @param float $y
174
+     * @return float
175
+     */
176
+    protected function y($y) { return $this->_height - $y; }
177
+
178
+    /**
179
+     * Sets the stroke colour
180
+     *
181
+     * @param array $color
182
+     */
183
+    protected function _set_stroke_colour($colour) {
185 184
     $colour[0] = round(255 * $colour[0]);
186 185
     $colour[1] = round(255 * $colour[1]);
187 186
     $colour[2] = round(255 * $colour[2]);
188 187
 
189 188
     if ( is_null($this->_last_stroke_color) || $color != $this->_last_stroke_color ) {
190
-      $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
191
-      $this->_last_stroke_color = $color;
189
+        $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
190
+        $this->_last_stroke_color = $color;
192 191
     }
193 192
 
194
-  }
193
+    }
195 194
 
196
-  /**
197
-   * Sets the fill colour
198
-   *
199
-   * @param array $color
200
-   */
201
-  protected function _set_fill_colour($colour) {
195
+    /**
196
+     * Sets the fill colour
197
+     *
198
+     * @param array $color
199
+     */
200
+    protected function _set_fill_colour($colour) {
202 201
     $colour[0] = round(255 * $colour[0]);
203 202
     $colour[1] = round(255 * $colour[1]);
204 203
     $colour[2] = round(255 * $colour[2]);
205 204
 
206 205
     if ( is_null($this->_last_fill_color) || $color != $this->_last_fill_color ) {
207
-      $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
208
-      $this->_last_fill_color = $color;
206
+        $this->_pdf->SetDrawColor($color[0],$color[1],$color[2]);
207
+        $this->_last_fill_color = $color;
209 208
     }
210 209
 
211
-  }
210
+    }
212 211
 
213
-  /**
214
-   * Return the TCPDF instance
215
-   *
216
-   * @return TCPDF
217
-   */
218
-  function get_tcpdf() { return $this->_pdf; }
212
+    /**
213
+     * Return the TCPDF instance
214
+     *
215
+     * @return TCPDF
216
+     */
217
+    function get_tcpdf() { return $this->_pdf; }
219 218
   
220
-  /**
221
-   * Returns the current page number
222
-   *
223
-   * @return int
224
-   */
225
-  function get_page_number() {
219
+    /**
220
+     * Returns the current page number
221
+     *
222
+     * @return int
223
+     */
224
+    function get_page_number() {
226 225
     return $this->_page_number;
227
-  }
228
-
229
-  /**
230
-   * Returns the total number of pages
231
-   *
232
-   * @return int
233
-   */
234
-  function get_page_count() {
226
+    }
227
+
228
+    /**
229
+     * Returns the total number of pages
230
+     *
231
+     * @return int
232
+     */
233
+    function get_page_count() {
235 234
     return $this->_page_count;
236
-  }
237
-
238
-  /**
239
-   * Sets the total number of pages
240
-   *
241
-   * @param int $count
242
-   */
243
-  function set_page_count($count) {
235
+    }
236
+
237
+    /**
238
+     * Sets the total number of pages
239
+     *
240
+     * @param int $count
241
+     */
242
+    function set_page_count($count) {
244 243
     $this->_page_count = (int)$count;
245
-  }
246
-
247
-  /**
248
-   * Draws a line from x1,y1 to x2,y2
249
-   *
250
-   * See {@link Style::munge_colour()} for the format of the colour array.
251
-   * See {@link Cpdf::setLineStyle()} for a description of the format of the
252
-   * $style parameter (aka dash).
253
-   *
254
-   * @param float $x1
255
-   * @param float $y1
256
-   * @param float $x2
257
-   * @param float $y2
258
-   * @param array $color
259
-   * @param float $width
260
-   * @param array $style
261
-   */
262
-  function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
244
+    }
245
+
246
+    /**
247
+     * Draws a line from x1,y1 to x2,y2
248
+     *
249
+     * See {@link Style::munge_colour()} for the format of the colour array.
250
+     * See {@link Cpdf::setLineStyle()} for a description of the format of the
251
+     * $style parameter (aka dash).
252
+     *
253
+     * @param float $x1
254
+     * @param float $y1
255
+     * @param float $x2
256
+     * @param float $y2
257
+     * @param array $color
258
+     * @param float $width
259
+     * @param array $style
260
+     */
261
+    function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
263 262
 
264 263
     if ( is_null($this->_last_line_width) || $width != $this->_last_line_width ) {
265
-      $this->_pdf->SetLineWidth($width);
266
-      $this->_last_line_width = $width;
264
+        $this->_pdf->SetLineWidth($width);
265
+        $this->_last_line_width = $width;
267 266
     }
268 267
 
269 268
     $this->_set_stroke_colour($color);
270 269
 
271 270
     // FIXME: ugh, need to handle different styles here
272 271
     $this->_pdf->line($x1, $y1, $x2, $y2);
273
-  }
274
-
275
-  /**
276
-   * Draws a rectangle at x1,y1 with width w and height h
277
-   *
278
-   * See {@link Style::munge_colour()} for the format of the colour array.
279
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
280
-   * parameter (aka dash)
281
-   *
282
-   * @param float $x1
283
-   * @param float $y1
284
-   * @param float $w
285
-   * @param float $h
286
-   * @param array $color
287
-   * @param float $width
288
-   * @param array $style
289
-   */   
290
-  function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
272
+    }
273
+
274
+    /**
275
+     * Draws a rectangle at x1,y1 with width w and height h
276
+     *
277
+     * See {@link Style::munge_colour()} for the format of the colour array.
278
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
279
+     * parameter (aka dash)
280
+     *
281
+     * @param float $x1
282
+     * @param float $y1
283
+     * @param float $w
284
+     * @param float $h
285
+     * @param array $color
286
+     * @param float $width
287
+     * @param array $style
288
+     */   
289
+    function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) {
291 290
 
292 291
     if ( is_null($this->_last_line_width) || $width != $this->_last_line_width ) {
293
-      $this->_pdf->SetLineWidth($width);
294
-      $this->_last_line_width = $width;
292
+        $this->_pdf->SetLineWidth($width);
293
+        $this->_last_line_width = $width;
295 294
     }
296 295
 
297 296
     $this->_set_stroke_colour($color);
@@ -299,165 +298,165 @@  discard block
 block discarded – undo
299 298
     // FIXME: ugh, need to handle styles here
300 299
     $this->_pdf->rect($x1, $y1, $w, $h);
301 300
     
302
-  }
303
-
304
-  /**
305
-   * Draws a filled rectangle at x1,y1 with width w and height h
306
-   *
307
-   * See {@link Style::munge_colour()} for the format of the colour array.
308
-   *
309
-   * @param float $x1
310
-   * @param float $y1
311
-   * @param float $w
312
-   * @param float $h
313
-   * @param array $color
314
-   */   
315
-  function filled_rectangle($x1, $y1, $w, $h, $color) {
301
+    }
302
+
303
+    /**
304
+     * Draws a filled rectangle at x1,y1 with width w and height h
305
+     *
306
+     * See {@link Style::munge_colour()} for the format of the colour array.
307
+     *
308
+     * @param float $x1
309
+     * @param float $y1
310
+     * @param float $w
311
+     * @param float $h
312
+     * @param array $color
313
+     */   
314
+    function filled_rectangle($x1, $y1, $w, $h, $color) {
316 315
 
317 316
     $this->_set_fill_colour($color);
318 317
     
319 318
     // FIXME: ugh, need to handle styles here
320 319
     $this->_pdf->rect($x1, $y1, $w, $h, "F");
321
-  }
322
-
323
-  /**
324
-   * Draws a polygon
325
-   *
326
-   * The polygon is formed by joining all the points stored in the $points
327
-   * array.  $points has the following structure:
328
-   * <code>
329
-   * array(0 => x1,
330
-   *       1 => y1,
331
-   *       2 => x2,
332
-   *       3 => y2,
333
-   *       ...
334
-   *       );
335
-   * </code>
336
-   *
337
-   * See {@link Style::munge_colour()} for the format of the colour array.
338
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
339
-   * parameter (aka dash)   
340
-   *
341
-   * @param array $points
342
-   * @param array $color
343
-   * @param float $width
344
-   * @param array $style
345
-   * @param bool  $fill  Fills the polygon if true
346
-   */
347
-  function polygon($points, $color, $width = null, $style = null, $fill = false) {
320
+    }
321
+
322
+    /**
323
+     * Draws a polygon
324
+     *
325
+     * The polygon is formed by joining all the points stored in the $points
326
+     * array.  $points has the following structure:
327
+     * <code>
328
+     * array(0 => x1,
329
+     *       1 => y1,
330
+     *       2 => x2,
331
+     *       3 => y2,
332
+     *       ...
333
+     *       );
334
+     * </code>
335
+     *
336
+     * See {@link Style::munge_colour()} for the format of the colour array.
337
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
338
+     * parameter (aka dash)   
339
+     *
340
+     * @param array $points
341
+     * @param array $color
342
+     * @param float $width
343
+     * @param array $style
344
+     * @param bool  $fill  Fills the polygon if true
345
+     */
346
+    function polygon($points, $color, $width = null, $style = null, $fill = false) {
348 347
     // FIXME: FPDF sucks
349
-  }
350
-
351
-  /**
352
-   * Draws a circle at $x,$y with radius $r
353
-   *
354
-   * See {@link Style::munge_colour()} for the format of the colour array.
355
-   * See {@link Cpdf::setLineStyle()} for a description of the $style
356
-   * parameter (aka dash)
357
-   *
358
-   * @param float $x
359
-   * @param float $y
360
-   * @param float $r
361
-   * @param array $color
362
-   * @param float $width
363
-   * @param array $style
364
-   * @param bool $fill Fills the circle if true   
365
-   */   
366
-  function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false){}
367
-
368
-  /**
369
-   * Add an image to the pdf.
370
-   *
371
-   * The image is placed at the specified x and y coordinates with the
372
-   * given width and height.
373
-   *
374
-   * @param string $img_url the path to the image
375
-   * @param string $img_type the type (e.g. extension) of the image
376
-   * @param float $x x position
377
-   * @param float $y y position
378
-   * @param int $w width (in pixels)
379
-   * @param int $h height (in pixels)
380
-   */
381
-  function image($img_url, $img_type, $x, $y, $w, $h){}
382
-
383
-  /**
384
-   * Writes text at the specified x and y coordinates
385
-   *
386
-   * See {@link Style::munge_colour()} for the format of the colour array.
387
-   *
388
-   * @param float $x
389
-   * @param float $y
390
-   * @param string $text the text to write
391
-   * @param string $font the font file to use
392
-   * @param float $size the font size, in points
393
-   * @param array $color
394
-   * @param float $adjust word spacing adjustment
395
-   */
396
-  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0){}
397
-
398
-  function javascript($code){}
348
+    }
349
+
350
+    /**
351
+     * Draws a circle at $x,$y with radius $r
352
+     *
353
+     * See {@link Style::munge_colour()} for the format of the colour array.
354
+     * See {@link Cpdf::setLineStyle()} for a description of the $style
355
+     * parameter (aka dash)
356
+     *
357
+     * @param float $x
358
+     * @param float $y
359
+     * @param float $r
360
+     * @param array $color
361
+     * @param float $width
362
+     * @param array $style
363
+     * @param bool $fill Fills the circle if true   
364
+     */   
365
+    function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false){}
366
+
367
+    /**
368
+     * Add an image to the pdf.
369
+     *
370
+     * The image is placed at the specified x and y coordinates with the
371
+     * given width and height.
372
+     *
373
+     * @param string $img_url the path to the image
374
+     * @param string $img_type the type (e.g. extension) of the image
375
+     * @param float $x x position
376
+     * @param float $y y position
377
+     * @param int $w width (in pixels)
378
+     * @param int $h height (in pixels)
379
+     */
380
+    function image($img_url, $img_type, $x, $y, $w, $h){}
381
+
382
+    /**
383
+     * Writes text at the specified x and y coordinates
384
+     *
385
+     * See {@link Style::munge_colour()} for the format of the colour array.
386
+     *
387
+     * @param float $x
388
+     * @param float $y
389
+     * @param string $text the text to write
390
+     * @param string $font the font file to use
391
+     * @param float $size the font size, in points
392
+     * @param array $color
393
+     * @param float $adjust word spacing adjustment
394
+     */
395
+    function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0){}
396
+
397
+    function javascript($code){}
399 398
   
400
-  /**
401
-   * Add a named destination (similar to <a name="foo">...</a> in html)
402
-   *
403
-   * @param string $anchorname The name of the named destination
404
-   */
405
-  function add_named_dest($anchorname){}
406
-
407
-  /**
408
-   * Add a link to the pdf
409
-   *
410
-   * @param string $url The url to link to
411
-   * @param float  $x   The x position of the link
412
-   * @param float  $y   The y position of the link
413
-   * @param float  $width   The width of the link
414
-   * @param float  $height   The height of the link
415
-   */
416
-  function add_link($url, $x, $y, $width, $height){}
399
+    /**
400
+     * Add a named destination (similar to <a name="foo">...</a> in html)
401
+     *
402
+     * @param string $anchorname The name of the named destination
403
+     */
404
+    function add_named_dest($anchorname){}
405
+
406
+    /**
407
+     * Add a link to the pdf
408
+     *
409
+     * @param string $url The url to link to
410
+     * @param float  $x   The x position of the link
411
+     * @param float  $y   The y position of the link
412
+     * @param float  $width   The width of the link
413
+     * @param float  $height   The height of the link
414
+     */
415
+    function add_link($url, $x, $y, $width, $height){}
417 416
   
418
-  /**
419
-   * Calculates text size, in points
420
-   *
421
-   * @param string $text the text to be sized
422
-   * @param string $font the desired font
423
-   * @param float  $size the desired font size
424
-   * @param float  $spacing word spacing, if any
425
-   * @return float
426
-   */
427
-  function get_text_width($text, $font, $size, $spacing = 0){}
428
-
429
-  /**
430
-   * Calculates font height, in points
431
-   *
432
-   * @param string $font
433
-   * @param float $size
434
-   * @return float
435
-   */
436
-  function get_font_height($font, $size){}
417
+    /**
418
+     * Calculates text size, in points
419
+     *
420
+     * @param string $text the text to be sized
421
+     * @param string $font the desired font
422
+     * @param float  $size the desired font size
423
+     * @param float  $spacing word spacing, if any
424
+     * @return float
425
+     */
426
+    function get_text_width($text, $font, $size, $spacing = 0){}
427
+
428
+    /**
429
+     * Calculates font height, in points
430
+     *
431
+     * @param string $font
432
+     * @param float $size
433
+     * @return float
434
+     */
435
+    function get_font_height($font, $size){}
437 436
 
438 437
   
439
-  /**
440
-   * Starts a new page
441
-   *
442
-   * Subsequent drawing operations will appear on the new page.
443
-   */
444
-  function new_page(){}
445
-
446
-  /**
447
-   * Streams the PDF directly to the browser
448
-   *
449
-   * @param string $filename the name of the PDF file
450
-   * @param array  $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
451
-   */
452
-  function stream($filename, $options = null){}
453
-
454
-  /**
455
-   * Returns the PDF as a string
456
-   *
457
-   * @param array  $options associative array: 'compress' => 1 or 0
458
-   * @return string
459
-   */
460
-  function output($options = null){}
438
+    /**
439
+     * Starts a new page
440
+     *
441
+     * Subsequent drawing operations will appear on the new page.
442
+     */
443
+    function new_page(){}
444
+
445
+    /**
446
+     * Streams the PDF directly to the browser
447
+     *
448
+     * @param string $filename the name of the PDF file
449
+     * @param array  $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
450
+     */
451
+    function stream($filename, $options = null){}
452
+
453
+    /**
454
+     * Returns the PDF as a string
455
+     *
456
+     * @param array  $options associative array: 'compress' => 1 or 0
457
+     * @return string
458
+     */
459
+    function output($options = null){}
461 460
   
462 461
 }
463 462
     
Please login to merge, or discard this patch.