@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: php_evaluator.cls.php,v $ |
|
6 | - * Created on: 2004-07-12 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: php_evaluator.cls.php,v $ |
|
6 | + * Created on: 2004-07-12 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: php_evaluator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -47,15 +46,15 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class PHP_Evaluator { |
49 | 48 | |
50 | - protected $_canvas; |
|
49 | + protected $_canvas; |
|
51 | 50 | |
52 | - function __construct(Canvas $canvas) { |
|
51 | + function __construct(Canvas $canvas) { |
|
53 | 52 | $this->_canvas = $canvas; |
54 | - } |
|
53 | + } |
|
55 | 54 | |
56 | - function evaluate($code, $vars = array()) { |
|
55 | + function evaluate($code, $vars = array()) { |
|
57 | 56 | if ( !DOMPDF_ENABLE_PHP ) |
58 | - return; |
|
57 | + return; |
|
59 | 58 | |
60 | 59 | // Set up some variables for the inline code |
61 | 60 | $pdf = $this->_canvas; |
@@ -68,9 +67,9 @@ discard block |
||
68 | 67 | } |
69 | 68 | |
70 | 69 | eval(utf8_decode($code)); |
71 | - } |
|
70 | + } |
|
72 | 71 | |
73 | - function render($frame) { |
|
72 | + function render($frame) { |
|
74 | 73 | $this->evaluate($frame->get_node()->nodeValue); |
75 | - } |
|
74 | + } |
|
76 | 75 | } |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: frame_tree.cls.php,v $ |
|
6 | - * Created on: 2004-06-02 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: frame_tree.cls.php,v $ |
|
6 | + * Created on: 2004-06-02 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: frame_tree.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -52,118 +51,118 @@ discard block |
||
52 | 51 | */ |
53 | 52 | class Frame_Tree { |
54 | 53 | |
55 | - /** |
|
56 | - * Tags to ignore while parsing the tree |
|
57 | - * |
|
58 | - * @var array |
|
59 | - */ |
|
60 | - static protected $_HIDDEN_TAGS = array("area", "base", "basefont", "head", "style", |
|
61 | - "meta", "title", "colgroup", |
|
62 | - "noembed", "noscript", "param", "#comment"); |
|
63 | - /** |
|
64 | - * The main DomDocument |
|
65 | - * |
|
66 | - * @see http://ca2.php.net/manual/en/ref.dom.php |
|
67 | - * @var DomDocument |
|
68 | - */ |
|
69 | - protected $_dom; |
|
70 | - |
|
71 | - /** |
|
72 | - * The root node of the FrameTree. |
|
73 | - * |
|
74 | - * @var Frame |
|
75 | - */ |
|
76 | - protected $_root; |
|
77 | - |
|
78 | - /** |
|
79 | - * Subtrees of absolutely positioned elements |
|
80 | - * |
|
81 | - * @var array of Frames |
|
82 | - */ |
|
83 | - protected $_absolute_frames; |
|
84 | - |
|
85 | - /** |
|
86 | - * A mapping of {@link Frame} objects to DomNode objects |
|
87 | - * |
|
88 | - * @var array |
|
89 | - */ |
|
90 | - protected $_registry; |
|
54 | + /** |
|
55 | + * Tags to ignore while parsing the tree |
|
56 | + * |
|
57 | + * @var array |
|
58 | + */ |
|
59 | + static protected $_HIDDEN_TAGS = array("area", "base", "basefont", "head", "style", |
|
60 | + "meta", "title", "colgroup", |
|
61 | + "noembed", "noscript", "param", "#comment"); |
|
62 | + /** |
|
63 | + * The main DomDocument |
|
64 | + * |
|
65 | + * @see http://ca2.php.net/manual/en/ref.dom.php |
|
66 | + * @var DomDocument |
|
67 | + */ |
|
68 | + protected $_dom; |
|
69 | + |
|
70 | + /** |
|
71 | + * The root node of the FrameTree. |
|
72 | + * |
|
73 | + * @var Frame |
|
74 | + */ |
|
75 | + protected $_root; |
|
76 | + |
|
77 | + /** |
|
78 | + * Subtrees of absolutely positioned elements |
|
79 | + * |
|
80 | + * @var array of Frames |
|
81 | + */ |
|
82 | + protected $_absolute_frames; |
|
83 | + |
|
84 | + /** |
|
85 | + * A mapping of {@link Frame} objects to DomNode objects |
|
86 | + * |
|
87 | + * @var array |
|
88 | + */ |
|
89 | + protected $_registry; |
|
91 | 90 | |
92 | 91 | |
93 | - /** |
|
94 | - * Class constructor |
|
95 | - * |
|
96 | - * @param DomDocument $dom the main DomDocument object representing the current html document |
|
97 | - */ |
|
98 | - function __construct(DomDocument $dom) { |
|
92 | + /** |
|
93 | + * Class constructor |
|
94 | + * |
|
95 | + * @param DomDocument $dom the main DomDocument object representing the current html document |
|
96 | + */ |
|
97 | + function __construct(DomDocument $dom) { |
|
99 | 98 | $this->_dom = $dom; |
100 | 99 | $this->_root = null; |
101 | 100 | $this->_registry = array(); |
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Returns the DomDocument object representing the curent html document |
|
106 | - * |
|
107 | - * @return DomDocument |
|
108 | - */ |
|
109 | - function get_dom() { return $this->_dom; } |
|
110 | - |
|
111 | - /** |
|
112 | - * Returns the root frame of the tree |
|
113 | - * |
|
114 | - * @return Frame |
|
115 | - */ |
|
116 | - function get_root() { return $this->_root; } |
|
117 | - |
|
118 | - /** |
|
119 | - * Returns a specific frame given its id |
|
120 | - * |
|
121 | - * @param string $id |
|
122 | - * @return Frame |
|
123 | - */ |
|
124 | - function get_frame($id) { return isset($this->_registry[$id]) ? $this->_registry[$id] : null; } |
|
125 | - |
|
126 | - /** |
|
127 | - * Returns a post-order iterator for all frames in the tree |
|
128 | - * |
|
129 | - * @return FrameTreeList |
|
130 | - */ |
|
131 | - function get_frames() { return new FrameTreeList($this->_root); } |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Returns the DomDocument object representing the curent html document |
|
105 | + * |
|
106 | + * @return DomDocument |
|
107 | + */ |
|
108 | + function get_dom() { return $this->_dom; } |
|
109 | + |
|
110 | + /** |
|
111 | + * Returns the root frame of the tree |
|
112 | + * |
|
113 | + * @return Frame |
|
114 | + */ |
|
115 | + function get_root() { return $this->_root; } |
|
116 | + |
|
117 | + /** |
|
118 | + * Returns a specific frame given its id |
|
119 | + * |
|
120 | + * @param string $id |
|
121 | + * @return Frame |
|
122 | + */ |
|
123 | + function get_frame($id) { return isset($this->_registry[$id]) ? $this->_registry[$id] : null; } |
|
124 | + |
|
125 | + /** |
|
126 | + * Returns a post-order iterator for all frames in the tree |
|
127 | + * |
|
128 | + * @return FrameTreeList |
|
129 | + */ |
|
130 | + function get_frames() { return new FrameTreeList($this->_root); } |
|
132 | 131 | |
133 | - /** |
|
134 | - * Builds the tree |
|
135 | - */ |
|
136 | - function build_tree() { |
|
132 | + /** |
|
133 | + * Builds the tree |
|
134 | + */ |
|
135 | + function build_tree() { |
|
137 | 136 | $html = $this->_dom->getElementsByTagName("html")->item(0); |
138 | 137 | if ( is_null($html) ) |
139 | - $html = $this->_dom->firstChild; |
|
138 | + $html = $this->_dom->firstChild; |
|
140 | 139 | |
141 | 140 | if ( is_null($html) ) |
142 | - throw new DOMPDF_Exception("Requested HTML document contains no data."); |
|
141 | + throw new DOMPDF_Exception("Requested HTML document contains no data."); |
|
143 | 142 | |
144 | 143 | $this->_root = $this->_build_tree_r($html); |
145 | 144 | |
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Recursively adds {@link Frame} objects to the tree |
|
150 | - * |
|
151 | - * Recursively build a tree of Frame objects based on a dom tree. |
|
152 | - * No layout information is calculated at this time, although the |
|
153 | - * tree may be adjusted (i.e. nodes and frames for generated content |
|
154 | - * and images may be created). |
|
155 | - * |
|
156 | - * @param DomNode $node the current DomNode being considered |
|
157 | - * @return Frame |
|
158 | - */ |
|
159 | - protected function _build_tree_r(DomNode $node) { |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * Recursively adds {@link Frame} objects to the tree |
|
149 | + * |
|
150 | + * Recursively build a tree of Frame objects based on a dom tree. |
|
151 | + * No layout information is calculated at this time, although the |
|
152 | + * tree may be adjusted (i.e. nodes and frames for generated content |
|
153 | + * and images may be created). |
|
154 | + * |
|
155 | + * @param DomNode $node the current DomNode being considered |
|
156 | + * @return Frame |
|
157 | + */ |
|
158 | + protected function _build_tree_r(DomNode $node) { |
|
160 | 159 | |
161 | 160 | $frame = new Frame($node); |
162 | 161 | $id = $frame->get_id(); |
163 | 162 | $this->_registry[ $id ] = $frame; |
164 | 163 | |
165 | 164 | if ( !$node->hasChildNodes() ) |
166 | - return $frame; |
|
165 | + return $frame; |
|
167 | 166 | |
168 | 167 | // Fixes 'cannot access undefined property for object with |
169 | 168 | // overloaded access', fix by Stefan radulian |
@@ -173,55 +172,55 @@ discard block |
||
173 | 172 | // Store the children in an array so that the tree can be modified |
174 | 173 | $children = array(); |
175 | 174 | for ($i = 0; $i < $node->childNodes->length; $i++) |
176 | - $children[] = $node->childNodes->item($i); |
|
175 | + $children[] = $node->childNodes->item($i); |
|
177 | 176 | |
178 | 177 | foreach ($children as $child) { |
179 | - // Skip non-displaying nodes |
|
180 | - if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) ) { |
|
178 | + // Skip non-displaying nodes |
|
179 | + if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) ) { |
|
181 | 180 | if ( mb_strtolower($child->nodeName) !== "head" && |
182 | 181 | mb_strtolower($child->nodeName) !== "style" ) |
183 | - $child->parentNode->removeChild($child); |
|
182 | + $child->parentNode->removeChild($child); |
|
184 | 183 | continue; |
185 | - } |
|
184 | + } |
|
186 | 185 | |
187 | - // Skip empty text nodes |
|
188 | - if ( $child->nodeName === "#text" && $child->nodeValue == "" ) { |
|
186 | + // Skip empty text nodes |
|
187 | + if ( $child->nodeName === "#text" && $child->nodeValue == "" ) { |
|
189 | 188 | $child->parentNode->removeChild($child); |
190 | 189 | continue; |
191 | - } |
|
190 | + } |
|
192 | 191 | |
193 | - // Skip empty image nodes |
|
194 | - if ( $child->nodeName === "img" && $child->getAttribute("src") == "" ) { |
|
192 | + // Skip empty image nodes |
|
193 | + if ( $child->nodeName === "img" && $child->getAttribute("src") == "" ) { |
|
195 | 194 | $child->parentNode->removeChild($child); |
196 | 195 | continue; |
197 | - } |
|
196 | + } |
|
198 | 197 | |
199 | - // Add a container frame for images |
|
200 | - if ( $child->nodeName === "img" ) { |
|
198 | + // Add a container frame for images |
|
199 | + if ( $child->nodeName === "img" ) { |
|
201 | 200 | $img_node = $child->ownerDocument->createElement("img_inner"); |
202 | 201 | |
203 | 202 | // Move attributes to inner node |
204 | 203 | foreach ( $child->attributes as $attr => $attr_node ) { |
205 | - // Skip style, but move all other attributes |
|
206 | - if ( $attr === "style" ) |
|
204 | + // Skip style, but move all other attributes |
|
205 | + if ( $attr === "style" ) |
|
207 | 206 | continue; |
208 | 207 | |
209 | - $img_node->setAttribute($attr, $attr_node->value); |
|
208 | + $img_node->setAttribute($attr, $attr_node->value); |
|
210 | 209 | } |
211 | 210 | |
212 | 211 | foreach ( $child->attributes as $attr => $node ) { |
213 | - if ( $attr === "style" ) |
|
212 | + if ( $attr === "style" ) |
|
214 | 213 | continue; |
215 | - $child->removeAttribute($attr); |
|
214 | + $child->removeAttribute($attr); |
|
216 | 215 | } |
217 | 216 | |
218 | 217 | $child->appendChild($img_node); |
219 | - } |
|
218 | + } |
|
220 | 219 | |
221 | - $frame->append_child($this->_build_tree_r($child), false); |
|
220 | + $frame->append_child($this->_build_tree_r($child), false); |
|
222 | 221 | |
223 | 222 | } |
224 | 223 | |
225 | 224 | return $frame; |
226 | - } |
|
225 | + } |
|
227 | 226 | } |
@@ -34,7 +34,6 @@ discard block |
||
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: null_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,13 +46,13 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Null_Frame_Decorator extends Frame_Decorator { |
49 | 48 | |
50 | - function __construct(Frame $frame, DOMPDF $dompdf) { |
|
49 | + function __construct(Frame $frame, DOMPDF $dompdf) { |
|
51 | 50 | parent::__construct($frame, $dompdf); |
52 | 51 | $style = $this->_frame->get_style(); |
53 | 52 | $style->width = 0; |
54 | 53 | $style->height = 0; |
55 | 54 | $style->margin = 0; |
56 | 55 | $style->padding = 0; |
57 | - } |
|
56 | + } |
|
58 | 57 | |
59 | 58 | } |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: canvas_factory.cls.php,v $ |
|
6 | - * Created on: 2004-06-02 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: canvas_factory.cls.php,v $ |
|
6 | + * Created on: 2004-06-02 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: canvas_factory.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -49,35 +48,35 @@ discard block |
||
49 | 48 | */ |
50 | 49 | class Canvas_Factory { |
51 | 50 | |
52 | - /** |
|
53 | - * Constructor is private: this is a static class |
|
54 | - */ |
|
55 | - private function __construct() { } |
|
51 | + /** |
|
52 | + * Constructor is private: this is a static class |
|
53 | + */ |
|
54 | + private function __construct() { } |
|
56 | 55 | |
57 | - static function get_instance($paper = null, $orientation = null, $class = null) { |
|
56 | + static function get_instance($paper = null, $orientation = null, $class = null) { |
|
58 | 57 | |
59 | 58 | $backend = strtolower(DOMPDF_PDF_BACKEND); |
60 | 59 | |
61 | 60 | if ( isset($class) && class_exists($class, false) ) |
62 | - $class .= "_Adapter"; |
|
61 | + $class .= "_Adapter"; |
|
63 | 62 | |
64 | 63 | else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib" ) && |
65 | 64 | class_exists("PDFLib", false) ) |
66 | - $class = "PDFLib_Adapter"; |
|
65 | + $class = "PDFLib_Adapter"; |
|
67 | 66 | |
68 | 67 | else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf") ) |
69 | - $class = "CPDF_Adapter"; |
|
68 | + $class = "CPDF_Adapter"; |
|
70 | 69 | |
71 | 70 | else if ( ( $backend === "tcpdf") ) |
72 | - $class = "TCPDF_Adapter"; |
|
71 | + $class = "TCPDF_Adapter"; |
|
73 | 72 | |
74 | 73 | else if ( $backend === "gd" ) |
75 | - $class = "GD_Adapter"; |
|
74 | + $class = "GD_Adapter"; |
|
76 | 75 | |
77 | 76 | else |
78 | - $class = "CPDF_Adapter"; |
|
77 | + $class = "CPDF_Adapter"; |
|
79 | 78 | |
80 | 79 | return new $class($paper, $orientation); |
81 | 80 | |
82 | - } |
|
81 | + } |
|
83 | 82 | } |
@@ -34,7 +34,6 @@ discard block |
||
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: block_renderer.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,26 +46,26 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Block_Renderer extends Abstract_Renderer { |
49 | 48 | |
50 | - //........................................................................ |
|
49 | + //........................................................................ |
|
51 | 50 | |
52 | - function render(Frame $frame) { |
|
51 | + function render(Frame $frame) { |
|
53 | 52 | $style = $frame->get_style(); |
54 | 53 | list($x, $y, $w, $h) = $frame->get_padding_box(); |
55 | 54 | |
56 | 55 | // Draw our background, border and content |
57 | 56 | if ( ($bg = $style->background_color) !== "transparent" ) { |
58 | - $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
|
57 | + $this->_canvas->filled_rectangle( $x, $y, $w, $h, $style->background_color ); |
|
59 | 58 | } |
60 | 59 | |
61 | 60 | if ( ($url = $style->background_image) && $url !== "none" ) |
62 | - $this->_background_image($url, $x, $y, $w, $h, $style); |
|
61 | + $this->_background_image($url, $x, $y, $w, $h, $style); |
|
63 | 62 | |
64 | 63 | |
65 | 64 | $this->_render_border($frame); |
66 | 65 | |
67 | - } |
|
66 | + } |
|
68 | 67 | |
69 | - protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") { |
|
68 | + protected function _render_border(Frame_Decorator $frame, $corner_style = "bevel") { |
|
70 | 69 | $cb = $frame->get_containing_block(); |
71 | 70 | $style = $frame->get_style(); |
72 | 71 | |
@@ -79,36 +78,36 @@ discard block |
||
79 | 78 | $style->length_in_pt($bp["left"]["width"])); |
80 | 79 | |
81 | 80 | foreach ($bp as $side => $props) { |
82 | - list($x, $y, $w, $h) = $bbox; |
|
81 | + list($x, $y, $w, $h) = $bbox; |
|
83 | 82 | |
84 | - if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) |
|
83 | + if ( !$props["style"] || $props["style"] === "none" || $props["width"] <= 0 ) |
|
85 | 84 | continue; |
86 | 85 | |
87 | 86 | |
88 | - switch($side) { |
|
89 | - case "top": |
|
87 | + switch($side) { |
|
88 | + case "top": |
|
90 | 89 | $length = $w; |
91 | 90 | break; |
92 | 91 | |
93 | - case "bottom": |
|
92 | + case "bottom": |
|
94 | 93 | $length = $w; |
95 | 94 | $y += $h; |
96 | 95 | break; |
97 | 96 | |
98 | - case "left": |
|
97 | + case "left": |
|
99 | 98 | $length = $h; |
100 | 99 | break; |
101 | 100 | |
102 | - case "right": |
|
101 | + case "right": |
|
103 | 102 | $length = $h; |
104 | 103 | $x += $w; |
105 | 104 | break; |
106 | - default: |
|
105 | + default: |
|
107 | 106 | break; |
108 | - } |
|
109 | - $method = "_border_" . $props["style"]; |
|
107 | + } |
|
108 | + $method = "_border_" . $props["style"]; |
|
110 | 109 | |
111 | - $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style); |
|
110 | + $this->$method($x, $y, $length, $props["color"], $widths, $side, $corner_style); |
|
111 | + } |
|
112 | 112 | } |
113 | - } |
|
114 | 113 | } |
@@ -1,47 +1,46 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: inline_frame_decorator.cls.php,v $ |
|
6 | - * Created on: 2004-06-02 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @contributor Helmut Tischer <[email protected]> |
|
37 | - * @package dompdf |
|
38 | - |
|
39 | - * |
|
40 | - * Changes |
|
41 | - * @contributor Helmut Tischer <[email protected]> |
|
42 | - * @version 20090610 |
|
43 | - * - don't repeat non repeatable background images after a line break |
|
44 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: inline_frame_decorator.cls.php,v $ |
|
6 | + * Created on: 2004-06-02 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @contributor Helmut Tischer <[email protected]> |
|
37 | + * @package dompdf |
|
38 | + * |
|
39 | + * Changes |
|
40 | + * @contributor Helmut Tischer <[email protected]> |
|
41 | + * @version 20090610 |
|
42 | + * - don't repeat non repeatable background images after a line break |
|
43 | + */ |
|
45 | 44 | |
46 | 45 | /* $Id: inline_frame_decorator.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
47 | 46 | |
@@ -53,17 +52,17 @@ discard block |
||
53 | 52 | */ |
54 | 53 | class Inline_Frame_Decorator extends Frame_Decorator { |
55 | 54 | |
56 | - function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); } |
|
55 | + function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); } |
|
57 | 56 | |
58 | - function split($frame = null) { |
|
57 | + function split($frame = null) { |
|
59 | 58 | |
60 | 59 | if ( is_null($frame) ) { |
61 | - $this->get_parent()->split($this); |
|
62 | - return; |
|
60 | + $this->get_parent()->split($this); |
|
61 | + return; |
|
63 | 62 | } |
64 | 63 | |
65 | 64 | if ( $frame->get_parent() !== $this ) |
66 | - throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
65 | + throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); |
|
67 | 66 | |
68 | 67 | $split = $this->copy( $this->_frame->get_node()->cloneNode() ); |
69 | 68 | $this->get_parent()->insert_child_after($split, $this); |
@@ -86,18 +85,18 @@ discard block |
||
86 | 85 | //See e.g. in testcase image_variants, long desriptions |
87 | 86 | if ( ($url = $style->background_image) && $url !== "none" |
88 | 87 | && ($repeat = $style->background_repeat) && $repeat !== "repeat" && $repeat !== "repeat-y" |
89 | - ) { |
|
90 | - $style->background_image = "none"; |
|
88 | + ) { |
|
89 | + $style->background_image = "none"; |
|
91 | 90 | } |
92 | 91 | |
93 | 92 | // Add $frame and all following siblings to the new split node |
94 | 93 | $iter = $frame; |
95 | 94 | while ($iter) { |
96 | - $frame = $iter; |
|
97 | - $iter = $iter->get_next_sibling(); |
|
98 | - $frame->reset(); |
|
99 | - $split->append_child($frame); |
|
95 | + $frame = $iter; |
|
96 | + $iter = $iter->get_next_sibling(); |
|
97 | + $frame->reset(); |
|
98 | + $split->append_child($frame); |
|
99 | + } |
|
100 | 100 | } |
101 | - } |
|
102 | 101 | |
103 | 102 | } |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: renderer.cls.php,v $ |
|
6 | - * Created on: 2004-06-03 |
|
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: renderer.cls.php,v $ |
|
6 | + * Created on: 2004-06-03 |
|
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: renderer.cls.php 217 2010-03-11 23:03:57Z ryan.masten $ */ |
41 | 40 | |
@@ -50,38 +49,38 @@ discard block |
||
50 | 49 | */ |
51 | 50 | class Renderer extends Abstract_Renderer { |
52 | 51 | |
53 | - /** |
|
54 | - * Array of renderers for specific frame types |
|
55 | - * |
|
56 | - * @var array |
|
57 | - */ |
|
58 | - protected $_renderers; |
|
52 | + /** |
|
53 | + * Array of renderers for specific frame types |
|
54 | + * |
|
55 | + * @var array |
|
56 | + */ |
|
57 | + protected $_renderers; |
|
59 | 58 | |
60 | - /** |
|
61 | - * Cache of the callbacks array |
|
62 | - * |
|
63 | - * @var array |
|
64 | - */ |
|
65 | - private $_callbacks; |
|
59 | + /** |
|
60 | + * Cache of the callbacks array |
|
61 | + * |
|
62 | + * @var array |
|
63 | + */ |
|
64 | + private $_callbacks; |
|
66 | 65 | |
67 | - /** |
|
68 | - * Advance the canvas to the next page |
|
69 | - */ |
|
70 | - function new_page() { |
|
66 | + /** |
|
67 | + * Advance the canvas to the next page |
|
68 | + */ |
|
69 | + function new_page() { |
|
71 | 70 | $this->_canvas->new_page(); |
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Render frames recursively |
|
76 | - * |
|
77 | - * @param Frame $frame the frame to render |
|
78 | - */ |
|
79 | - function render(Frame $frame) { |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * Render frames recursively |
|
75 | + * |
|
76 | + * @param Frame $frame the frame to render |
|
77 | + */ |
|
78 | + function render(Frame $frame) { |
|
80 | 79 | global $_dompdf_debug; |
81 | 80 | |
82 | 81 | if ( $_dompdf_debug ) { |
83 | - echo $frame; |
|
84 | - flush(); |
|
82 | + echo $frame; |
|
83 | + flush(); |
|
85 | 84 | } |
86 | 85 | |
87 | 86 | $display = $frame->get_style()->display; |
@@ -97,46 +96,46 @@ discard block |
||
97 | 96 | case "table-footer-group": |
98 | 97 | case "inline-table": |
99 | 98 | $this->_render_frame("block", $frame); |
100 | - break; |
|
99 | + break; |
|
101 | 100 | |
102 | 101 | case "inline": |
103 | 102 | if ( $frame->get_node()->nodeName === "#text" ) |
104 | 103 | $this->_render_frame("text", $frame); |
105 | - else |
|
104 | + else |
|
106 | 105 | $this->_render_frame("inline", $frame); |
107 | - break; |
|
106 | + break; |
|
108 | 107 | |
109 | 108 | case "table-cell": |
110 | 109 | $this->_render_frame("table-cell", $frame); |
111 | - break; |
|
110 | + break; |
|
112 | 111 | |
113 | 112 | case "-dompdf-list-bullet": |
114 | 113 | $this->_render_frame("list-bullet", $frame); |
115 | - break; |
|
114 | + break; |
|
116 | 115 | |
117 | 116 | case "-dompdf-image": |
118 | 117 | $this->_render_frame("image", $frame); |
119 | - break; |
|
118 | + break; |
|
120 | 119 | |
121 | 120 | case "none": |
122 | 121 | $node = $frame->get_node(); |
123 | 122 | |
124 | - if ( $node->nodeName === "script" ) { |
|
123 | + if ( $node->nodeName === "script" ) { |
|
125 | 124 | if ( $node->getAttribute("type") === "text/php" || |
126 | 125 | $node->getAttribute("language") === "php" ) { |
127 | - // Evaluate embedded php scripts |
|
128 | - $this->_render_frame("php", $frame); |
|
126 | + // Evaluate embedded php scripts |
|
127 | + $this->_render_frame("php", $frame); |
|
129 | 128 | } |
130 | 129 | |
131 | 130 | elseif ( $node->getAttribute("type") === "text/javascript" || |
132 | 131 | $node->getAttribute("language") === "javascript" ) { |
133 | - // Insert JavaScript |
|
134 | - $this->_render_frame("javascript", $frame); |
|
132 | + // Insert JavaScript |
|
133 | + $this->_render_frame("javascript", $frame); |
|
134 | + } |
|
135 | 135 | } |
136 | - } |
|
137 | 136 | |
138 | - // Don't render children, so skip to next iter |
|
139 | - return; |
|
137 | + // Don't render children, so skip to next iter |
|
138 | + return; |
|
140 | 139 | |
141 | 140 | default: |
142 | 141 | break; |
@@ -147,90 +146,90 @@ discard block |
||
147 | 146 | $this->_check_callbacks("begin_frame", $frame); |
148 | 147 | |
149 | 148 | foreach ($frame->get_children() as $child) |
150 | - $this->render($child); |
|
149 | + $this->render($child); |
|
151 | 150 | |
152 | 151 | // Check for end frame callback |
153 | 152 | $this->_check_callbacks("end_frame", $frame); |
154 | 153 | |
155 | - } |
|
154 | + } |
|
156 | 155 | |
157 | - /** |
|
158 | - * Check for callbacks that need to be performed when a given event |
|
159 | - * gets triggered on a frame |
|
160 | - * |
|
161 | - * @param string $event the type of event |
|
162 | - * @param Frame $frame the frame that event is triggered on |
|
163 | - */ |
|
164 | - protected function _check_callbacks($event, $frame) { |
|
156 | + /** |
|
157 | + * Check for callbacks that need to be performed when a given event |
|
158 | + * gets triggered on a frame |
|
159 | + * |
|
160 | + * @param string $event the type of event |
|
161 | + * @param Frame $frame the frame that event is triggered on |
|
162 | + */ |
|
163 | + protected function _check_callbacks($event, $frame) { |
|
165 | 164 | if (!isset($this->_callbacks)) { |
166 | - $this->_callbacks = $this->_dompdf->get_callbacks(); |
|
165 | + $this->_callbacks = $this->_dompdf->get_callbacks(); |
|
167 | 166 | } |
168 | 167 | |
169 | 168 | if (is_array($this->_callbacks) && isset($this->_callbacks[$event])) { |
170 | - $info = array(0 => $this->_canvas, "canvas" => $this->_canvas, |
|
169 | + $info = array(0 => $this->_canvas, "canvas" => $this->_canvas, |
|
171 | 170 | 1 => $frame, "frame" => $frame); |
172 | - $fs = $this->_callbacks[$event]; |
|
173 | - foreach ($fs as $f) { |
|
171 | + $fs = $this->_callbacks[$event]; |
|
172 | + foreach ($fs as $f) { |
|
174 | 173 | if (is_callable($f)) { |
175 | - if (is_array($f)) { |
|
174 | + if (is_array($f)) { |
|
176 | 175 | $f[0]->$f[1]($info); |
177 | - } else { |
|
176 | + } else { |
|
178 | 177 | $f($info); |
179 | - } |
|
178 | + } |
|
180 | 179 | } |
181 | - } |
|
180 | + } |
|
181 | + } |
|
182 | 182 | } |
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Render a single frame |
|
187 | - * |
|
188 | - * Creates Renderer objects on demand |
|
189 | - * |
|
190 | - * @param string $type type of renderer to use |
|
191 | - * @param Frame $frame the frame to render |
|
192 | - */ |
|
193 | - protected function _render_frame($type, $frame) { |
|
183 | + |
|
184 | + /** |
|
185 | + * Render a single frame |
|
186 | + * |
|
187 | + * Creates Renderer objects on demand |
|
188 | + * |
|
189 | + * @param string $type type of renderer to use |
|
190 | + * @param Frame $frame the frame to render |
|
191 | + */ |
|
192 | + protected function _render_frame($type, $frame) { |
|
194 | 193 | |
195 | 194 | if ( !isset($this->_renderers[$type]) ) { |
196 | 195 | |
197 | - switch ($type) { |
|
198 | - case "block": |
|
196 | + switch ($type) { |
|
197 | + case "block": |
|
199 | 198 | $this->_renderers["block"] = new Block_Renderer($this->_dompdf); |
200 | 199 | break; |
201 | 200 | |
202 | - case "inline": |
|
201 | + case "inline": |
|
203 | 202 | $this->_renderers["inline"] = new Inline_Renderer($this->_dompdf); |
204 | 203 | break; |
205 | 204 | |
206 | - case "text": |
|
205 | + case "text": |
|
207 | 206 | $this->_renderers["text"] = new Text_Renderer($this->_dompdf); |
208 | 207 | break; |
209 | 208 | |
210 | - case "image": |
|
209 | + case "image": |
|
211 | 210 | $this->_renderers["image"] = new Image_Renderer($this->_dompdf); |
212 | 211 | break; |
213 | 212 | |
214 | - case "table-cell": |
|
213 | + case "table-cell": |
|
215 | 214 | $this->_renderers["table-cell"] = new Table_Cell_Renderer($this->_dompdf); |
216 | 215 | break; |
217 | 216 | |
218 | - case "list-bullet": |
|
217 | + case "list-bullet": |
|
219 | 218 | $this->_renderers["list-bullet"] = new List_Bullet_Renderer($this->_dompdf); |
220 | 219 | break; |
221 | 220 | |
222 | - case "php": |
|
221 | + case "php": |
|
223 | 222 | $this->_renderers["php"] = new PHP_Evaluator($this->_canvas); |
224 | 223 | break; |
225 | 224 | |
226 | - case "javascript": |
|
225 | + case "javascript": |
|
227 | 226 | $this->_renderers["javascript"] = new Javascript_Embedder($this->_dompdf); |
228 | 227 | break; |
229 | 228 | |
230 | - } |
|
229 | + } |
|
231 | 230 | } |
232 | 231 | |
233 | 232 | $this->_renderers[$type]->render($frame); |
234 | 233 | |
235 | - } |
|
234 | + } |
|
236 | 235 | } |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: null_positioner.cls.php,v $ |
|
6 | - * Created on: 2004-07-12 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: null_positioner.cls.php,v $ |
|
6 | + * Created on: 2004-07-12 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: null_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | |
@@ -47,10 +46,10 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Null_Positioner extends Positioner { |
49 | 48 | |
50 | - function __construct(Frame_Decorator $frame) { |
|
49 | + function __construct(Frame_Decorator $frame) { |
|
51 | 50 | parent::__construct($frame); |
52 | - } |
|
51 | + } |
|
53 | 52 | |
54 | - function position() { return; } |
|
53 | + function position() { return; } |
|
55 | 54 | |
56 | 55 | } |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | * @copyright 2004 Benj Carson |
35 | 35 | * @author Benj Carson <[email protected]> |
36 | 36 | * @package dompdf |
37 | - |
|
38 | 37 | */ |
39 | 38 | |
40 | 39 | /* $Id: frame_factory.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -52,119 +51,119 @@ discard block |
||
52 | 51 | */ |
53 | 52 | class Frame_Factory { |
54 | 53 | |
55 | - static function decorate_root(Frame $root, DOMPDF $dompdf) { |
|
54 | + static function decorate_root(Frame $root, DOMPDF $dompdf) { |
|
56 | 55 | $frame = new Page_Frame_Decorator($root, $dompdf); |
57 | 56 | $frame->set_reflower( new Page_Frame_Reflower($frame) ); |
58 | 57 | $root->set_decorator($frame); |
59 | 58 | return $frame; |
60 | - } |
|
59 | + } |
|
61 | 60 | |
62 | - // FIXME: this is admittedly a little smelly... |
|
63 | - static function decorate_frame(Frame $frame, $dompdf) { |
|
61 | + // FIXME: this is admittedly a little smelly... |
|
62 | + static function decorate_frame(Frame $frame, $dompdf) { |
|
64 | 63 | if ( is_null($dompdf) ) |
65 | - throw new Exception("foo"); |
|
64 | + throw new Exception("foo"); |
|
66 | 65 | switch ($frame->get_style()->display) { |
67 | 66 | |
68 | 67 | case "block": |
69 | 68 | $positioner = "Block"; |
70 | - $decorator = "Block"; |
|
71 | - $reflower = "Block"; |
|
72 | - break; |
|
69 | + $decorator = "Block"; |
|
70 | + $reflower = "Block"; |
|
71 | + break; |
|
73 | 72 | |
74 | 73 | case "inline-block": |
75 | 74 | $positioner = "Inline"; |
76 | - $decorator = "Block"; |
|
77 | - $reflower = "Block"; |
|
78 | - break; |
|
75 | + $decorator = "Block"; |
|
76 | + $reflower = "Block"; |
|
77 | + break; |
|
79 | 78 | |
80 | 79 | case "inline": |
81 | 80 | $positioner = "Inline"; |
82 | - if ( $frame->get_node()->nodeName === "#text" ) { |
|
81 | + if ( $frame->get_node()->nodeName === "#text" ) { |
|
83 | 82 | $decorator = "Text"; |
84 | 83 | $reflower = "Text"; |
85 | - } else { |
|
84 | + } else { |
|
86 | 85 | $decorator = "Inline"; |
87 | 86 | $reflower = "Inline"; |
88 | - } |
|
89 | - break; |
|
87 | + } |
|
88 | + break; |
|
90 | 89 | |
91 | 90 | case "table": |
92 | 91 | $positioner = "Block"; |
93 | - $decorator = "Table"; |
|
94 | - $reflower = "Table"; |
|
95 | - break; |
|
92 | + $decorator = "Table"; |
|
93 | + $reflower = "Table"; |
|
94 | + break; |
|
96 | 95 | |
97 | 96 | case "inline-table": |
98 | 97 | $positioner = "Inline"; |
99 | - $decorator = "Table"; |
|
100 | - $reflower = "Table"; |
|
101 | - break; |
|
98 | + $decorator = "Table"; |
|
99 | + $reflower = "Table"; |
|
100 | + break; |
|
102 | 101 | |
103 | 102 | case "table-row-group": |
104 | 103 | case "table-header-group": |
105 | 104 | case "table-footer-group": |
106 | 105 | $positioner = "Null"; |
107 | - $decorator = "Table_Row_Group"; |
|
108 | - $reflower = "Table_Row_Group"; |
|
109 | - break; |
|
106 | + $decorator = "Table_Row_Group"; |
|
107 | + $reflower = "Table_Row_Group"; |
|
108 | + break; |
|
110 | 109 | |
111 | 110 | case "table-row": |
112 | 111 | $positioner = "Null"; |
113 | - $decorator = "Table_Row"; |
|
114 | - $reflower = "Table_Row"; |
|
115 | - break; |
|
112 | + $decorator = "Table_Row"; |
|
113 | + $reflower = "Table_Row"; |
|
114 | + break; |
|
116 | 115 | |
117 | 116 | case "table-cell": |
118 | 117 | $positioner = "Table_Cell"; |
119 | - $decorator = "Table_Cell"; |
|
120 | - $reflower = "Table_Cell"; |
|
121 | - break; |
|
118 | + $decorator = "Table_Cell"; |
|
119 | + $reflower = "Table_Cell"; |
|
120 | + break; |
|
122 | 121 | |
123 | 122 | case "list-item": |
124 | 123 | $positioner = "Block"; |
125 | - $decorator = "Block"; |
|
126 | - $reflower = "Block"; |
|
127 | - break; |
|
124 | + $decorator = "Block"; |
|
125 | + $reflower = "Block"; |
|
126 | + break; |
|
128 | 127 | |
129 | 128 | case "-dompdf-list-bullet": |
130 | 129 | if ( $frame->get_style()->list_style_position === "inside" ) |
131 | 130 | $positioner = "Inline"; |
132 | - else |
|
131 | + else |
|
133 | 132 | $positioner = "List_Bullet"; |
134 | 133 | |
135 | - if ( $frame->get_style()->list_style_image !== "none" ) |
|
134 | + if ( $frame->get_style()->list_style_image !== "none" ) |
|
136 | 135 | $decorator = "List_Bullet_Image"; |
137 | - else |
|
136 | + else |
|
138 | 137 | $decorator = "List_Bullet"; |
139 | 138 | |
140 | - $reflower = "List_Bullet"; |
|
141 | - break; |
|
139 | + $reflower = "List_Bullet"; |
|
140 | + break; |
|
142 | 141 | |
143 | 142 | case "-dompdf-image": |
144 | 143 | $positioner = "Inline"; |
145 | - $decorator = "Image"; |
|
146 | - $reflower = "Image"; |
|
147 | - break; |
|
144 | + $decorator = "Image"; |
|
145 | + $reflower = "Image"; |
|
146 | + break; |
|
148 | 147 | |
149 | 148 | case "-dompdf-br": |
150 | 149 | $positioner = "Inline"; |
151 | - $decorator = "Inline"; |
|
152 | - $reflower = "Inline"; |
|
153 | - break; |
|
150 | + $decorator = "Inline"; |
|
151 | + $reflower = "Inline"; |
|
152 | + break; |
|
154 | 153 | |
155 | 154 | default: |
156 | 155 | // FIXME: should throw some sort of warning or something? |
157 | 156 | case "none": |
158 | 157 | $positioner = "Null"; |
159 | - $decorator = "Null"; |
|
160 | - $reflower = "Null"; |
|
161 | - break; |
|
158 | + $decorator = "Null"; |
|
159 | + $reflower = "Null"; |
|
160 | + break; |
|
162 | 161 | |
163 | 162 | } |
164 | 163 | |
165 | 164 | if ( $frame->get_style()->position === "absolute" || |
166 | 165 | $frame->get_style()->position === "fixed" ) |
167 | - $positioner = "Absolute"; |
|
166 | + $positioner = "Absolute"; |
|
168 | 167 | |
169 | 168 | $positioner .= "_Positioner"; |
170 | 169 | $decorator .= "_Frame_Decorator"; |
@@ -176,10 +175,10 @@ discard block |
||
176 | 175 | |
177 | 176 | // Generated content is a special case |
178 | 177 | if ( $frame->get_node()->nodeName === "_dompdf_generated" ) { |
179 | - // Decorate the reflower |
|
180 | - $gen = new Generated_Frame_Reflower( $deco ); |
|
181 | - $gen->set_reflower( $reflow ); |
|
182 | - $reflow = $gen; |
|
178 | + // Decorate the reflower |
|
179 | + $gen = new Generated_Frame_Reflower( $deco ); |
|
180 | + $gen->set_reflower( $reflow ); |
|
181 | + $reflow = $gen; |
|
183 | 182 | } |
184 | 183 | |
185 | 184 | $deco->set_reflower( $reflow ); |
@@ -204,6 +203,6 @@ discard block |
||
204 | 203 | // } |
205 | 204 | |
206 | 205 | return $deco; |
207 | - } |
|
206 | + } |
|
208 | 207 | |
209 | 208 | } |