@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Constructor |
14 | 14 | */ |
15 | - public function __construct() |
|
15 | + public function __construct() |
|
16 | 16 | { |
17 | 17 | $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE); |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function get_all($where_conditions = array()) |
21 | 21 | { |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Displays the title + grid |
31 | 31 | */ |
32 | - public function display() |
|
32 | + public function display() |
|
33 | 33 | { |
34 | - // action links |
|
35 | - $content = Display::actions(array( |
|
34 | + // action links |
|
35 | + $content = Display::actions(array( |
|
36 | 36 | array( |
37 | 37 | 'url' => 'event_type.php' , |
38 | 38 | 'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM) |
39 | - ) |
|
39 | + ) |
|
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | $content .= Display::grid_html('event_email_template'); |
43 | 43 | return $content; |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | public function get_status_list() |
47 | 47 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'Height' => '250', |
83 | 83 | ) |
84 | 84 | ); |
85 | - $status_list = $this->get_status_list(); |
|
85 | + $status_list = $this->get_status_list(); |
|
86 | 86 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
87 | 87 | if ($action == 'edit') { |
88 | 88 | $form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | $defaults = $this->get($id); |
100 | 100 | |
101 | 101 | if (!empty($defaults['created_at'])) { |
102 | - $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); |
|
102 | + $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); |
|
103 | 103 | } |
104 | 104 | if (!empty($defaults['updated_at'])) { |
105 | - $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); |
|
105 | + $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); |
|
106 | 106 | } |
107 | 107 | $form->setDefaults($defaults); |
108 | 108 | |
109 | 109 | // Setting the rules |
110 | 110 | $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
111 | 111 | |
112 | - return $form; |
|
112 | + return $form; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function get_count() |
@@ -3,17 +3,17 @@ discard block |
||
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 |
||
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 |
||
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"> |
@@ -1,9 +1,9 @@ |
||
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"?' . '>'; ?> |
@@ -52,28 +52,28 @@ discard block |
||
52 | 52 | */ |
53 | 53 | class Image_Frame_Decorator extends Frame_Decorator { |
54 | 54 | |
55 | - /** |
|
56 | - * The path to the image file (note that remote images are |
|
57 | - * downloaded locally to DOMPDF_TEMP_DIR). |
|
58 | - * |
|
59 | - * @var string |
|
60 | - */ |
|
61 | - protected $_image_url; |
|
55 | + /** |
|
56 | + * The path to the image file (note that remote images are |
|
57 | + * downloaded locally to DOMPDF_TEMP_DIR). |
|
58 | + * |
|
59 | + * @var string |
|
60 | + */ |
|
61 | + protected $_image_url; |
|
62 | 62 | |
63 | - /** |
|
64 | - * The image's file extension (i.e. png, jpeg, gif) |
|
65 | - * |
|
66 | - * @var string |
|
67 | - */ |
|
68 | - protected $_image_ext; |
|
63 | + /** |
|
64 | + * The image's file extension (i.e. png, jpeg, gif) |
|
65 | + * |
|
66 | + * @var string |
|
67 | + */ |
|
68 | + protected $_image_ext; |
|
69 | 69 | |
70 | - /** |
|
71 | - * Class constructor |
|
72 | - * |
|
73 | - * @param Frame $frame the frame to decorate |
|
74 | - * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls) |
|
75 | - */ |
|
76 | - function __construct(Frame $frame, DOMPDF $dompdf) { |
|
70 | + /** |
|
71 | + * Class constructor |
|
72 | + * |
|
73 | + * @param Frame $frame the frame to decorate |
|
74 | + * @param DOMPDF $dompdf the document's dompdf object (required to resolve relative & remote urls) |
|
75 | + */ |
|
76 | + function __construct(Frame $frame, DOMPDF $dompdf) { |
|
77 | 77 | global $_dompdf_warnings; |
78 | 78 | |
79 | 79 | parent::__construct($frame, $dompdf); |
@@ -83,28 +83,28 @@ discard block |
||
83 | 83 | if (DEBUGPNG) print '[__construct '.$url.']'; |
84 | 84 | |
85 | 85 | list($this->_image_url, $this->_image_ext) = Image_Cache::resolve_url($url, |
86 | - $dompdf->get_protocol(), |
|
87 | - $dompdf->get_host(), |
|
88 | - $dompdf->get_base_path()); |
|
86 | + $dompdf->get_protocol(), |
|
87 | + $dompdf->get_host(), |
|
88 | + $dompdf->get_base_path()); |
|
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Return the image's url |
|
94 | - * |
|
95 | - * @return string The url of this image |
|
96 | - */ |
|
97 | - function get_image_url() { |
|
92 | + /** |
|
93 | + * Return the image's url |
|
94 | + * |
|
95 | + * @return string The url of this image |
|
96 | + */ |
|
97 | + function get_image_url() { |
|
98 | 98 | return $this->_image_url; |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Return the image's file extension |
|
103 | - * |
|
104 | - * @return string The image's file extension |
|
105 | - */ |
|
106 | - function get_image_ext() { |
|
101 | + /** |
|
102 | + * Return the image's file extension |
|
103 | + * |
|
104 | + * @return string The image's file extension |
|
105 | + */ |
|
106 | + function get_image_ext() { |
|
107 | 107 | return $this->_image_ext; |
108 | - } |
|
108 | + } |
|
109 | 109 | |
110 | 110 | } |
@@ -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.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -53,105 +52,105 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -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_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -50,30 +49,30 @@ discard block |
||
50 | 49 | */ |
51 | 50 | abstract class Frame_Reflower { |
52 | 51 | |
53 | - /** |
|
54 | - * Frame for this reflower |
|
55 | - * |
|
56 | - * @var Frame |
|
57 | - */ |
|
58 | - protected $_frame; |
|
59 | - |
|
60 | - /** |
|
61 | - * Cached min/max size |
|
62 | - * |
|
63 | - * @var array |
|
64 | - */ |
|
65 | - protected $_min_max_cache; |
|
52 | + /** |
|
53 | + * Frame for this reflower |
|
54 | + * |
|
55 | + * @var Frame |
|
56 | + */ |
|
57 | + protected $_frame; |
|
58 | + |
|
59 | + /** |
|
60 | + * Cached min/max size |
|
61 | + * |
|
62 | + * @var array |
|
63 | + */ |
|
64 | + protected $_min_max_cache; |
|
66 | 65 | |
67 | - function __construct(Frame $frame) { |
|
66 | + function __construct(Frame $frame) { |
|
68 | 67 | $this->_frame = $frame; |
69 | 68 | $this->_min_max_cache = null; |
70 | - } |
|
69 | + } |
|
71 | 70 | |
72 | - function dispose() { |
|
71 | + function dispose() { |
|
73 | 72 | unset($this->_frame); |
74 | - } |
|
73 | + } |
|
75 | 74 | |
76 | - protected function _collapse_margins() { |
|
75 | + protected function _collapse_margins() { |
|
77 | 76 | $cb = $this->_frame->get_containing_block(); |
78 | 77 | $style = $this->_frame->get_style(); |
79 | 78 | |
@@ -82,121 +81,121 @@ discard block |
||
82 | 81 | |
83 | 82 | // Handle 'auto' values |
84 | 83 | if ( $t === "auto" ) { |
85 | - $style->margin_top = "0pt"; |
|
86 | - $t = 0; |
|
84 | + $style->margin_top = "0pt"; |
|
85 | + $t = 0; |
|
87 | 86 | } |
88 | 87 | |
89 | 88 | if ( $b === "auto" ) { |
90 | - $style->margin_bottom = "0pt"; |
|
91 | - $b = 0; |
|
89 | + $style->margin_bottom = "0pt"; |
|
90 | + $b = 0; |
|
92 | 91 | } |
93 | 92 | |
94 | 93 | // Collapse vertical margins: |
95 | 94 | $n = $this->_frame->get_next_sibling(); |
96 | 95 | while ( $n && !in_array($n->get_style()->display, Style::$BLOCK_TYPES) ) |
97 | - $n = $n->get_next_sibling(); |
|
96 | + $n = $n->get_next_sibling(); |
|
98 | 97 | |
99 | 98 | if ( $n ) { // && !$n instanceof Page_Frame_Decorator ) { |
100 | 99 | |
101 | - $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"])); |
|
100 | + $b = max($b, $style->length_in_pt($n->get_style()->margin_top, $cb["w"])); |
|
102 | 101 | |
103 | - $n->get_style()->margin_top = "$b pt"; |
|
104 | - $style->margin_bottom = "0 pt"; |
|
102 | + $n->get_style()->margin_top = "$b pt"; |
|
103 | + $style->margin_bottom = "0 pt"; |
|
105 | 104 | |
106 | 105 | } |
107 | 106 | |
108 | 107 | // Collapse our first child's margin |
109 | 108 | $f = $this->_frame->get_first_child(); |
110 | 109 | while ( $f && !in_array($f->get_style()->display, Style::$BLOCK_TYPES) ) |
111 | - $f = $f->get_next_sibling(); |
|
110 | + $f = $f->get_next_sibling(); |
|
112 | 111 | |
113 | 112 | if ( $f ) { |
114 | - $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"])); |
|
115 | - $style->margin_top = "$t pt"; |
|
116 | - $f->get_style()->margin_top = "0 pt"; |
|
113 | + $t = max( $t, $style->length_in_pt($f->get_style()->margin_top, $cb["w"])); |
|
114 | + $style->margin_top = "$t pt"; |
|
115 | + $f->get_style()->margin_top = "0 pt"; |
|
117 | 116 | } |
118 | 117 | |
119 | - } |
|
118 | + } |
|
120 | 119 | |
121 | - // Returns true if a new page is required |
|
122 | - protected function _check_new_page() { |
|
120 | + // Returns true if a new page is required |
|
121 | + protected function _check_new_page() { |
|
123 | 122 | $y = $this->_frame->get_position("y"); |
124 | 123 | $h = $style->length_in_pt($style->height); |
125 | 124 | // Check if we need to move to a new page |
126 | 125 | if ( $y + $h >= $this->_frame->get_root()->get_page_height() ) |
127 | - return true; |
|
126 | + return true; |
|
128 | 127 | |
129 | - } |
|
128 | + } |
|
130 | 129 | |
131 | - //........................................................................ |
|
130 | + //........................................................................ |
|
132 | 131 | |
133 | - abstract function reflow(); |
|
132 | + abstract function reflow(); |
|
134 | 133 | |
135 | - //........................................................................ |
|
134 | + //........................................................................ |
|
136 | 135 | |
137 | - // Required for table layout: Returns an array(0 => min, 1 => max, "min" |
|
138 | - // => min, "max" => max) of the minimum and maximum widths of this frame. |
|
139 | - // This provides a basic implementation. Child classes should override |
|
140 | - // this if necessary. |
|
141 | - function get_min_max_width() { |
|
136 | + // Required for table layout: Returns an array(0 => min, 1 => max, "min" |
|
137 | + // => min, "max" => max) of the minimum and maximum widths of this frame. |
|
138 | + // This provides a basic implementation. Child classes should override |
|
139 | + // this if necessary. |
|
140 | + function get_min_max_width() { |
|
142 | 141 | if ( !is_null($this->_min_max_cache) ) { |
143 | - return $this->_min_max_cache; |
|
142 | + return $this->_min_max_cache; |
|
144 | 143 | } |
145 | 144 | |
146 | 145 | $style = $this->_frame->get_style(); |
147 | 146 | |
148 | 147 | // Account for margins & padding |
149 | 148 | $dims = array($style->padding_left, |
150 | - $style->padding_right, |
|
151 | - $style->border_left_width, |
|
152 | - $style->border_right_width, |
|
153 | - $style->margin_left, |
|
154 | - $style->margin_right); |
|
149 | + $style->padding_right, |
|
150 | + $style->border_left_width, |
|
151 | + $style->border_right_width, |
|
152 | + $style->margin_left, |
|
153 | + $style->margin_right); |
|
155 | 154 | |
156 | 155 | $cb_w = $this->_frame->get_containing_block("w"); |
157 | 156 | $delta = $style->length_in_pt($dims, $cb_w); |
158 | 157 | |
159 | 158 | // Handle degenerate case |
160 | 159 | if ( !$this->_frame->get_first_child() ) |
161 | - return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta); |
|
160 | + return $this->_min_max_cache = array($delta, $delta,"min" => $delta, "max" => $delta); |
|
162 | 161 | |
163 | 162 | $low = array(); |
164 | 163 | $high = array(); |
165 | 164 | |
166 | 165 | for ( $iter = $this->_frame->get_children()->getIterator(); |
167 | - $iter->valid(); |
|
168 | - $iter->next() ) { |
|
166 | + $iter->valid(); |
|
167 | + $iter->next() ) { |
|
169 | 168 | |
170 | - $inline_min = 0; |
|
171 | - $inline_max = 0; |
|
169 | + $inline_min = 0; |
|
170 | + $inline_max = 0; |
|
172 | 171 | |
173 | - // Add all adjacent inline widths together to calculate max width |
|
174 | - while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) { |
|
172 | + // Add all adjacent inline widths together to calculate max width |
|
173 | + while ( $iter->valid() && in_array( $iter->current()->get_style()->display, Style::$INLINE_TYPES ) ) { |
|
175 | 174 | |
176 | 175 | $child = $iter->current(); |
177 | 176 | |
178 | 177 | $minmax = $child->get_min_max_width(); |
179 | 178 | |
180 | 179 | if ( in_array( $iter->current()->get_style()->white_space, array("pre", "nowrap") ) ) |
181 | - $inline_min += $minmax["min"]; |
|
180 | + $inline_min += $minmax["min"]; |
|
182 | 181 | else |
183 | - $low[] = $minmax["min"]; |
|
182 | + $low[] = $minmax["min"]; |
|
184 | 183 | |
185 | 184 | $inline_max += $minmax["max"]; |
186 | 185 | $iter->next(); |
187 | 186 | |
188 | - } |
|
187 | + } |
|
189 | 188 | |
190 | - if ( $inline_max > 0 ) |
|
189 | + if ( $inline_max > 0 ) |
|
191 | 190 | $high[] = $inline_max; |
192 | 191 | |
193 | - if ( $inline_min > 0 ) |
|
192 | + if ( $inline_min > 0 ) |
|
194 | 193 | $low[] = $inline_min; |
195 | 194 | |
196 | - if ( $iter->valid() ) { |
|
195 | + if ( $iter->valid() ) { |
|
197 | 196 | list($low[], $high[]) = $iter->current()->get_min_max_width(); |
198 | 197 | continue; |
199 | - } |
|
198 | + } |
|
200 | 199 | |
201 | 200 | } |
202 | 201 | $min = count($low) ? max($low) : 0; |
@@ -206,16 +205,16 @@ discard block |
||
206 | 205 | // content. If the width is a percentage ignore it for now. |
207 | 206 | $width = $style->width; |
208 | 207 | if ( $width !== "auto" && !is_percent($width) ) { |
209 | - $width = $style->length_in_pt($width, $cb_w); |
|
210 | - if ( $min < $width ) |
|
208 | + $width = $style->length_in_pt($width, $cb_w); |
|
209 | + if ( $min < $width ) |
|
211 | 210 | $min = $width; |
212 | - if ( $max < $width ) |
|
211 | + if ( $max < $width ) |
|
213 | 212 | $max = $width; |
214 | 213 | } |
215 | 214 | |
216 | 215 | $min += $delta; |
217 | 216 | $max += $delta; |
218 | 217 | return $this->_min_max_cache = array($min, $max, "min"=>$min, "max"=>$max); |
219 | - } |
|
218 | + } |
|
220 | 219 | |
221 | 220 | } |
@@ -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: table_row_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,22 +46,22 @@ discard block |
||
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 | } |
@@ -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 */ |
@@ -44,9 +43,9 @@ discard block |
||
44 | 43 | */ |
45 | 44 | class Absolute_Positioner extends Positioner { |
46 | 45 | |
47 | - function __construct(Frame_Decorator $frame) { parent::__construct($frame); } |
|
46 | + function __construct(Frame_Decorator $frame) { parent::__construct($frame); } |
|
48 | 47 | |
49 | - function position() { |
|
48 | + function position() { |
|
50 | 49 | |
51 | 50 | $cb = $this->_frame->get_containing_block(); |
52 | 51 | |
@@ -61,27 +60,27 @@ discard block |
||
61 | 60 | |
62 | 61 | if ( $p ) { |
63 | 62 | |
64 | - // Get the parent's padding box (see http://www.w3.org/TR/CSS21/visuren.html#propdef-top) |
|
63 | + // Get the parent's padding box (see http://www.w3.org/TR/CSS21/visuren.html#propdef-top) |
|
65 | 64 | |
66 | - list($x, $y, $w, $h) = $p->get_padding_box(); |
|
65 | + list($x, $y, $w, $h) = $p->get_padding_box(); |
|
67 | 66 | |
68 | 67 | } else { |
69 | 68 | |
70 | - $x = $cb["x"]; |
|
71 | - $y = $cb["y"]; |
|
69 | + $x = $cb["x"]; |
|
70 | + $y = $cb["y"]; |
|
72 | 71 | |
73 | 72 | } |
74 | 73 | |
75 | 74 | if ( isset($top) ) { |
76 | - $y += $top; |
|
75 | + $y += $top; |
|
77 | 76 | } else if ( isset($bottom) ) { |
78 | - // FIXME: need to know this frame's height before we can do this correctly |
|
77 | + // FIXME: need to know this frame's height before we can do this correctly |
|
79 | 78 | } |
80 | 79 | |
81 | 80 | $x += $left; |
82 | 81 | |
83 | 82 | $this->_frame->set_position($x, $y); |
84 | 83 | |
85 | - } |
|
84 | + } |
|
86 | 85 | |
87 | 86 | } |
88 | 87 | \ No newline at end of file |
@@ -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: inline_frame_reflower.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,11 +46,11 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Inline_Frame_Reflower extends Frame_Reflower { |
49 | 48 | |
50 | - function __construct(Frame $frame) { parent::__construct($frame); } |
|
49 | + function __construct(Frame $frame) { parent::__construct($frame); } |
|
51 | 50 | |
52 | - //........................................................................ |
|
51 | + //........................................................................ |
|
53 | 52 | |
54 | - function reflow() { |
|
53 | + function reflow() { |
|
55 | 54 | $style = $this->_frame->get_style(); |
56 | 55 | $this->_frame->position(); |
57 | 56 | |
@@ -59,23 +58,23 @@ discard block |
||
59 | 58 | |
60 | 59 | // Add our margin, padding & border to the first and last children |
61 | 60 | if ( ($f = $this->_frame->get_first_child()) && $f instanceof Text_Frame_Decorator ) { |
62 | - $f->get_style()->margin_left = $style->margin_left; |
|
63 | - $f->get_style()->padding_left = $style->padding_left; |
|
64 | - $f->get_style()->border_left = $style->border_left; |
|
61 | + $f->get_style()->margin_left = $style->margin_left; |
|
62 | + $f->get_style()->padding_left = $style->padding_left; |
|
63 | + $f->get_style()->border_left = $style->border_left; |
|
65 | 64 | } |
66 | 65 | |
67 | 66 | if ( ($l = $this->_frame->get_last_child()) && $l instanceof Text_Frame_Decorator ) { |
68 | - $f->get_style()->margin_right = $style->margin_right; |
|
69 | - $f->get_style()->padding_right = $style->padding_right; |
|
70 | - $f->get_style()->border_right = $style->border_right; |
|
67 | + $f->get_style()->margin_right = $style->margin_right; |
|
68 | + $f->get_style()->padding_right = $style->padding_right; |
|
69 | + $f->get_style()->border_right = $style->border_right; |
|
71 | 70 | } |
72 | 71 | |
73 | 72 | // Set the containing blocks and reflow each child. The containing |
74 | 73 | // block is not changed by line boxes. |
75 | 74 | foreach ( $this->_frame->get_children() as $child ) { |
76 | 75 | |
77 | - $child->set_containing_block($cb); |
|
78 | - $child->reflow(); |
|
76 | + $child->set_containing_block($cb); |
|
77 | + $child->reflow(); |
|
78 | + } |
|
79 | 79 | } |
80 | - } |
|
81 | 80 | } |