@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if (!defined('BASEPATH')) { |
|
25 | 25 | exit('No direct script access allowed'); |
26 | +} |
|
26 | 27 | |
27 | 28 | /** |
28 | 29 | * Dynamically build forms for display |
@@ -65,7 +66,7 @@ discard block |
||
65 | 66 | $file_name = explode("/", $url); |
66 | 67 | if(isset($file_name['1']) ){ |
67 | 68 | $module = explode('_', $file_name['1']); |
68 | - }else{ |
|
69 | + } else{ |
|
69 | 70 | $module=$file_name; |
70 | 71 | } |
71 | 72 | if($this->CI->session->userdata('userlevel_logintype')==1 ){ |
@@ -74,7 +75,7 @@ discard block |
||
74 | 75 | if (in_array($module[0], $module_info)) { |
75 | 76 | if($this->CI->session->userdata('userlevel_logintype')== 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] !='customer_transfer'){ |
76 | 77 | redirect(base_url() . 'user/user/'); |
77 | - }else{ |
|
78 | + } else{ |
|
78 | 79 | return true; |
79 | 80 | } |
80 | 81 | } else { |
@@ -139,23 +140,23 @@ discard block |
||
139 | 140 | foreach ($form_fileds as $fieldkey => $fieldvalue) { |
140 | 141 | $form_contents.= '<li class="col-md-12">'; |
141 | 142 | if ($fieldvalue[1] == 'HIDDEN') { |
142 | - if (isset($this->CI->input->post)) |
|
143 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
144 | - else |
|
145 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
|
143 | + if (isset($this->CI->input->post)) { |
|
144 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
145 | + } else { |
|
146 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
|
147 | + } |
|
146 | 148 | $form_contents.= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
147 | - }else { |
|
149 | + } else { |
|
148 | 150 | $validation_arr=array(); |
149 | 151 | if($fieldvalue[1]=='INPUT'){ |
150 | 152 | if(!empty($fieldvalue[3])){ |
151 | 153 | $validation_arr=explode("|",$fieldvalue[3]); |
152 | 154 | } |
153 | - } |
|
154 | - elseif($fieldvalue[2]=='SELECT'){ |
|
155 | + } elseif($fieldvalue[2]=='SELECT'){ |
|
155 | 156 | |
156 | 157 | if(is_array($fieldvalue[4])){ |
157 | 158 | $validation_arr=explode("|",$fieldvalue[4]['rules']); |
158 | - }else{ |
|
159 | + } else{ |
|
159 | 160 | $validation_arr=explode("|",$fieldvalue[4]); |
160 | 161 | } |
161 | 162 | } |
@@ -182,7 +183,7 @@ discard block |
||
182 | 183 | |
183 | 184 | if (isset($this->CI->input->post)){ |
184 | 185 | $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
185 | - }else{ |
|
186 | + } else{ |
|
186 | 187 | if (is_array($fieldvalue[1])) { |
187 | 188 | $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
188 | 189 | } else { |
@@ -201,16 +202,16 @@ discard block |
||
201 | 202 | |
202 | 203 | if(isset($fieldvalue[1]['name'])){ |
203 | 204 | $fieldvalue_pass=$fieldvalue[1]['name']; |
204 | - }else{ |
|
205 | + } else{ |
|
205 | 206 | $fieldvalue_pass=$fieldvalue[1]; |
206 | 207 | } |
207 | 208 | |
208 | 209 | $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
209 | - }else{ |
|
210 | + } else{ |
|
210 | 211 | |
211 | 212 | if(isset($fieldvalue[1]['name'])){ |
212 | 213 | $fieldvalue_pass=$fieldvalue[1]['name']; |
213 | - }else{ |
|
214 | + } else{ |
|
214 | 215 | $fieldvalue_pass=$fieldvalue[1]; |
215 | 216 | } |
216 | 217 | |
@@ -246,10 +247,11 @@ discard block |
||
246 | 247 | /* For multi select code */ |
247 | 248 | $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
248 | 249 | |
249 | - if (isset($this->CI->input->post)) |
|
250 | - $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
251 | - else |
|
252 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
250 | + if (isset($this->CI->input->post)) { |
|
251 | + $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
252 | + } else { |
|
253 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
254 | + } |
|
253 | 255 | |
254 | 256 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
255 | 257 | if ($fieldset_key === 'System Configuration Information') { |
@@ -266,9 +268,9 @@ discard block |
||
266 | 268 | } else if ($fieldvalue[1] == 'INPUT') { |
267 | 269 | |
268 | 270 | |
269 | - if (isset($this->CI->input->post)) |
|
270 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
271 | - else{ |
|
271 | + if (isset($this->CI->input->post)) { |
|
272 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
273 | + } else{ |
|
272 | 274 | $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
273 | 275 | } |
274 | 276 | $form_contents.= form_input($fieldvalue[2], 'readonly'); |
@@ -284,11 +286,11 @@ discard block |
||
284 | 286 | * Image upload from invoice configuration code. |
285 | 287 | */ |
286 | 288 | else if ($fieldvalue[1] == 'IMAGE') { |
287 | - if (isset($this->CI->input->post)) |
|
288 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
289 | - |
|
290 | - else |
|
291 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
289 | + if (isset($this->CI->input->post)) { |
|
290 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
291 | + } else { |
|
292 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
293 | + } |
|
292 | 294 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
293 | 295 | $form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
294 | 296 | $form_contents.=@$fieldvalue[6]; |
@@ -296,13 +298,12 @@ discard block |
||
296 | 298 | $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
297 | 299 | $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
298 | 300 | </span></div>'; |
299 | - } |
|
300 | - else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
301 | - if (isset($this->CI->input->post)) |
|
302 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
303 | - |
|
304 | - else |
|
305 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
301 | + } else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
302 | + if (isset($this->CI->input->post)) { |
|
303 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
304 | + } else { |
|
305 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
306 | + } |
|
306 | 307 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
307 | 308 | $form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
308 | 309 | $form_contents.=@$fieldvalue[6]; |
@@ -313,10 +314,11 @@ discard block |
||
313 | 314 | } |
314 | 315 | /**********************************************************************************/ |
315 | 316 | else if ($fieldvalue[1] == 'PASSWORD') { |
316 | - if (isset($this->CI->input->post)) |
|
317 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
318 | - else |
|
319 | - $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
317 | + if (isset($this->CI->input->post)) { |
|
318 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
319 | + } else { |
|
320 | + $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
321 | + } |
|
320 | 322 | $form_contents.= form_password($fieldvalue[2]); |
321 | 323 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
322 | 324 | $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.$fieldvalue[2]['name'].'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
@@ -325,12 +327,12 @@ discard block |
||
325 | 327 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
326 | 328 | $OptionArray = array(); |
327 | 329 | |
328 | - if(isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
329 | - $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
330 | + if(isset($fieldvalue[7]) && $fieldvalue[7] != '') { |
|
331 | + $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
332 | + } |
|
330 | 333 | if (isset($this->CI->input->post)){ |
331 | 334 | $fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
332 | - } |
|
333 | - else |
|
335 | + } else |
|
334 | 336 | { |
335 | 337 | $fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value']; |
336 | 338 | } |
@@ -342,18 +344,18 @@ discard block |
||
342 | 344 | if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){ |
343 | 345 | |
344 | 346 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray); |
345 | - }else{ |
|
347 | + } else{ |
|
346 | 348 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray); |
347 | 349 | } |
348 | 350 | } else if ($fieldvalue[1] == 'TEXTAREA') { |
349 | 351 | |
350 | - if (isset($this->CI->input->post)) |
|
351 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
352 | - else |
|
353 | - $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
352 | + if (isset($this->CI->input->post)) { |
|
353 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
354 | + } else { |
|
355 | + $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
356 | + } |
|
354 | 357 | $form_contents.= form_textarea($fieldvalue[2]); |
355 | - } |
|
356 | - else if ($fieldvalue[2] == 'RADIO') { |
|
358 | + } else if ($fieldvalue[2] == 'RADIO') { |
|
357 | 359 | |
358 | 360 | $form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
359 | 361 | } |
@@ -583,8 +585,9 @@ discard block |
||
583 | 585 | $json_data["json_paging"]['total'] = $config['total_rows']; |
584 | 586 | $perpage = $config['per_page']; |
585 | 587 | $start = ($page_no - 1) * $perpage; |
586 | - if ($start < 0) |
|
587 | - $start = 0; |
|
588 | + if ($start < 0) { |
|
589 | + $start = 0; |
|
590 | + } |
|
588 | 591 | $json_data["paging"]['start'] = $start; |
589 | 592 | $json_data["paging"]['page_no'] = $perpage; |
590 | 593 | return $json_data; |
@@ -613,7 +616,7 @@ discard block |
||
613 | 616 | if($field_arr[2]=="status"){ |
614 | 617 | $row['id'] = $row_id; |
615 | 618 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
616 | - }else{ |
|
619 | + } else{ |
|
617 | 620 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
618 | 621 | } |
619 | 622 | |
@@ -638,13 +641,13 @@ discard block |
||
638 | 641 | $fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
639 | 642 | if($acctype != ''){ |
640 | 643 | $jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype; |
641 | - }else{ |
|
644 | + } else{ |
|
642 | 645 | $jsn_tmp[$field_key] = $fieldstr; |
643 | 646 | } |
644 | 647 | |
645 | 648 | |
646 | 649 | /*********************************/ |
647 | - }else { |
|
650 | + } else { |
|
648 | 651 | $jsn_tmp[$field_key] = $row[$field_arr[2]]; |
649 | 652 | } |
650 | 653 | } else { |
@@ -678,15 +681,13 @@ discard block |
||
678 | 681 | */ |
679 | 682 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id); |
680 | 683 | /****************************************************************************/ |
681 | - } |
|
682 | - elseif($field_arr[0] == gettext("Profile Action")) |
|
684 | + } elseif($field_arr[0] == gettext("Profile Action")) |
|
683 | 685 | { |
684 | 686 | if(isset($field_arr[5]) && isset($field_arr[5]->START) && isset($field_arr[5]->STOP) && isset($field_arr[5]->RELOAD) && isset($field_arr[5]->RESCAN)){ |
685 | 687 | } |
686 | 688 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
687 | 689 | |
688 | - } |
|
689 | - else { |
|
690 | + } else { |
|
690 | 691 | $className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos"; |
691 | 692 | $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace '.$className.'" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; } |
692 | 693 | } |
@@ -715,7 +716,7 @@ discard block |
||
715 | 716 | if($field_arr[2]=="status"){ |
716 | 717 | $row['id'] = $row_id; |
717 | 718 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
718 | - }else{ |
|
719 | + } else{ |
|
719 | 720 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row[$field_arr[2]])); |
720 | 721 | } |
721 | 722 | /** |
@@ -733,14 +734,13 @@ discard block |
||
733 | 734 | } |
734 | 735 | $jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
735 | 736 | /*******************************/ |
736 | - }else { |
|
737 | + } else { |
|
737 | 738 | $jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : ""; |
738 | 739 | } |
739 | 740 | } else { |
740 | 741 | if ($field_arr[0] == "Action") { |
741 | 742 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
742 | - } |
|
743 | - else { |
|
743 | + } else { |
|
744 | 744 | $jsn_tmp[$field_key] = '<input type="checkbox" name="chkAll" id=' . $row['id'] . ' class="ace chkRefNos" onclick="clickchkbox(' . $row['id'] . ')" value=' . $row['id'] . '><lable class="lbl"></lable>'; |
745 | 745 | } |
746 | 746 | } |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if (!defined('BASEPATH')) { |
|
25 | 25 | exit('No direct script access allowed'); |
26 | +} |
|
26 | 27 | |
27 | 28 | /** |
28 | 29 | * Dynamically build forms for display |
@@ -118,9 +119,9 @@ discard block |
||
118 | 119 | } |
119 | 120 | |
120 | 121 | function build_template($template_type,$detail,$detail_type='') { |
121 | - if(!is_array($template_type)) |
|
122 | - $this->get_template($template_type); |
|
123 | - else{ |
|
122 | + if(!is_array($template_type)) { |
|
123 | + $this->get_template($template_type); |
|
124 | + } else{ |
|
124 | 125 | $this->message=$template_type['message']; |
125 | 126 | $this->subject=$template_type['subject']; |
126 | 127 | $template_type=''; |
@@ -142,11 +143,11 @@ discard block |
||
142 | 143 | /*************/ |
143 | 144 | $this->account_id=$templateinfo['accountid']; |
144 | 145 | unset($templateinfo['number']); |
146 | + } else if(!is_array($detail) && $detail_type=='') { |
|
147 | + $templateinfo=$this->get_account_info($detail); |
|
148 | + } else { |
|
149 | + $templateinfo=$this->get_info($detail,$detail_type); |
|
145 | 150 | } |
146 | - else if(!is_array($detail) && $detail_type=='') |
|
147 | - $templateinfo=$this->get_account_info($detail); |
|
148 | - else |
|
149 | - $templateinfo=$this->get_info($detail,$detail_type); |
|
150 | 151 | |
151 | 152 | if($this->get_admin_details() && is_array($templateinfo) && isset($templateinfo['first_name']) && $templateinfo['first_name']!=''){ |
152 | 153 | $this->message = html_entity_decode($this->message); |
@@ -219,7 +220,9 @@ discard block |
||
219 | 220 | } |
220 | 221 | function get_smtp_details() |
221 | 222 | { |
222 | - if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='')exit; |
|
223 | + if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='') { |
|
224 | + exit; |
|
225 | + } |
|
223 | 226 | $config['protocol'] = "smtp"; |
224 | 227 | $config['smtp_host'] = $this->smtp_host; |
225 | 228 | $config['smtp_port'] = $this->smtp_port; |
@@ -236,14 +239,15 @@ discard block |
||
236 | 239 | if(!$this->email){ |
237 | 240 | if(!$resend){ |
238 | 241 | $this->build_template($template_type,$details,$detail_type); |
239 | - }else{ |
|
242 | + } else{ |
|
240 | 243 | $this->set_email_paramenters($details); |
241 | 244 | } |
242 | 245 | |
243 | - if(!$brodcast) |
|
244 | - $history_id=$this->mail_history($attachment); |
|
245 | - else |
|
246 | - $history_id=$details['history_id']; |
|
246 | + if(!$brodcast) { |
|
247 | + $history_id=$this->mail_history($attachment); |
|
248 | + } else { |
|
249 | + $history_id=$details['history_id']; |
|
250 | + } |
|
247 | 251 | if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
248 | 252 | if(!$this->smtp){ |
249 | 253 | $this->get_smtp_details(); |
@@ -280,14 +284,15 @@ discard block |
||
280 | 284 | |
281 | 285 | if(!$resend){ |
282 | 286 | $this->build_template($template_type,$details,$detail_type); |
283 | - }else{ |
|
287 | + } else{ |
|
284 | 288 | $this->set_email_paramenters($details); |
285 | 289 | } |
286 | 290 | |
287 | - if(!$brodcast) |
|
288 | - $history_id=$this->mail_history($attachment); |
|
289 | - else |
|
290 | - $history_id=$details['history_id']; |
|
291 | + if(!$brodcast) { |
|
292 | + $history_id=$this->mail_history($attachment); |
|
293 | + } else { |
|
294 | + $history_id=$details['history_id']; |
|
295 | + } |
|
291 | 296 | if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
292 | 297 | if(!$this->smtp){ |
293 | 298 | $this->get_smtp_details(); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); |
40 | 40 | } elseif(isset($_SERVER['PATH_TRANSLATED'])) { |
41 | 41 | $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); |
42 | - } else { |
|
42 | + } else { |
|
43 | 43 | // define here your DOCUMENT_ROOT path if the previous fails |
44 | 44 | $_SERVER['DOCUMENT_ROOT'] = '/var/www'; |
45 | 45 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); |
36 | 36 | } elseif(isset($_SERVER['PATH_TRANSLATED'])) { |
37 | 37 | $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); |
38 | - } else { |
|
38 | + } else { |
|
39 | 39 | // define here your DOCUMENT_ROOT path if the previous fails |
40 | 40 | $_SERVER['DOCUMENT_ROOT'] = '/var/www'; |
41 | 41 | } |
@@ -65,7 +65,9 @@ |
||
65 | 65 | $handle = fopen($file, 'r'); |
66 | 66 | while (!feof($handle)) { |
67 | 67 | $line = fgetcsv($handle); |
68 | - if (count($line)!=2) continue; |
|
68 | + if (count($line)!=2) { |
|
69 | + continue; |
|
70 | + } |
|
69 | 71 | self::$_list[trim($line[0])] = trim($line[1]); |
70 | 72 | } |
71 | 73 | fclose($handle); |
@@ -114,12 +114,13 @@ discard block |
||
114 | 114 | // if it is a closure tag |
115 | 115 | if ($res['close']) { |
116 | 116 | // HTML validation |
117 | - if (count($parents)<1) |
|
118 | - throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos'])); |
|
119 | - else if ($parents[count($parents)-1]!=$res['name']) |
|
120 | - throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos'])); |
|
121 | - else |
|
122 | - unset($parents[count($parents)-1]); |
|
117 | + if (count($parents)<1) { |
|
118 | + throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos'])); |
|
119 | + } else if ($parents[count($parents)-1]!=$res['name']) { |
|
120 | + throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos'])); |
|
121 | + } else { |
|
122 | + unset($parents[count($parents)-1]); |
|
123 | + } |
|
123 | 124 | } else { |
124 | 125 | // if it is a autoclosed tag |
125 | 126 | if ($res['autoclose']) { |
@@ -131,8 +132,9 @@ discard block |
||
131 | 132 | $res['close'] = true; |
132 | 133 | } |
133 | 134 | // else :add a child for validation |
134 | - else |
|
135 | - $parents[count($parents)] = $res['name']; |
|
135 | + else { |
|
136 | + $parents[count($parents)] = $res['name']; |
|
137 | + } |
|
136 | 138 | } |
137 | 139 | |
138 | 140 | // if it is a <pre> tag (or <code> tag) not auclosed => update the flag |
@@ -169,7 +171,9 @@ discard block |
||
169 | 171 | $txt = str_replace(' ', ' ', $txt); |
170 | 172 | |
171 | 173 | // add a break line |
172 | - if ($k>0) $actions[] = $tagPreBr; |
|
174 | + if ($k>0) { |
|
175 | + $actions[] = $tagPreBr; |
|
176 | + } |
|
173 | 177 | |
174 | 178 | // save the action |
175 | 179 | $actions[] = array( |
@@ -202,21 +206,26 @@ discard block |
||
202 | 206 | // if it is a Text |
203 | 207 | if ($actions[$k]['name']=='write') { |
204 | 208 | // if the tag before the text is a tag to clean => ltrim on the text |
205 | - if ($k>0 && in_array($actions[$k-1]['name'], $tagsToClean)) |
|
206 | - $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']); |
|
209 | + if ($k>0 && in_array($actions[$k-1]['name'], $tagsToClean)) { |
|
210 | + $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']); |
|
211 | + } |
|
207 | 212 | |
208 | 213 | // if the tag after the text is a tag to clean => rtrim on the text |
209 | - if ($k<$nb-1 && in_array($actions[$k+1]['name'], $tagsToClean)) |
|
210 | - $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']); |
|
214 | + if ($k<$nb-1 && in_array($actions[$k+1]['name'], $tagsToClean)) { |
|
215 | + $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']); |
|
216 | + } |
|
211 | 217 | |
212 | 218 | // if the text is empty => remove the action |
213 | - if (!strlen($actions[$k]['param']['txt'])) |
|
214 | - unset($actions[$k]); |
|
219 | + if (!strlen($actions[$k]['param']['txt'])) { |
|
220 | + unset($actions[$k]); |
|
221 | + } |
|
215 | 222 | } |
216 | 223 | } |
217 | 224 | |
218 | 225 | // if we are not on the level 0 => HTML validator ERROR |
219 | - if (count($parents)) throw new HTML2PDF_exception(5, $parents); |
|
226 | + if (count($parents)) { |
|
227 | + throw new HTML2PDF_exception(5, $parents); |
|
228 | + } |
|
220 | 229 | |
221 | 230 | // save the actions to do |
222 | 231 | $this->code = array_values($actions); |
@@ -232,7 +241,9 @@ discard block |
||
232 | 241 | */ |
233 | 242 | protected function _prepareTxt($txt, $spaces = true) |
234 | 243 | { |
235 | - if ($spaces) $txt = preg_replace('/\s+/is', ' ', $txt); |
|
244 | + if ($spaces) { |
|
245 | + $txt = preg_replace('/\s+/is', ' ', $txt); |
|
246 | + } |
|
236 | 247 | $txt = str_replace('€', '€', $txt); |
237 | 248 | $txt = html_entity_decode($txt, ENT_QUOTES, $this->_encoding); |
238 | 249 | return $txt; |
@@ -261,7 +272,9 @@ discard block |
||
261 | 272 | // if it is a tag |
262 | 273 | if ($parse[1][0]) { |
263 | 274 | // save the previous text if it exists |
264 | - if ($str!=='') $tmp[] = array('txt', $str); |
|
275 | + if ($str!=='') { |
|
276 | + $tmp[] = array('txt', $str); |
|
277 | + } |
|
265 | 278 | |
266 | 279 | // save the tag, with the offset |
267 | 280 | $tmp[] = array('code', trim($parse[1][0]), $offset); |
@@ -278,7 +291,9 @@ discard block |
||
278 | 291 | unset($parse); |
279 | 292 | } |
280 | 293 | // if a text is present in the end, we save it |
281 | - if ($str!='') $tmp[] = array('txt', $str); |
|
294 | + if ($str!='') { |
|
295 | + $tmp[] = array('txt', $str); |
|
296 | + } |
|
282 | 297 | unset($str); |
283 | 298 | } |
284 | 299 | |
@@ -292,7 +307,9 @@ discard block |
||
292 | 307 | { |
293 | 308 | // name of the tag, opening, closure, autoclosure |
294 | 309 | $tag = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)'; |
295 | - if (!preg_match('/'.$tag.'/isU', $code, $match)) return null; |
|
310 | + if (!preg_match('/'.$tag.'/isU', $code, $match)) { |
|
311 | + return null; |
|
312 | + } |
|
296 | 313 | $close = ($match[1]=='/' ? true : false); |
297 | 314 | $autoclose = preg_match('/\/>$/isU', $code); |
298 | 315 | $name = strtolower($match[2]); |
@@ -311,20 +328,23 @@ discard block |
||
311 | 328 | // read the parameters : nom=valeur |
312 | 329 | $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)'; |
313 | 330 | preg_match_all('/'.$prop.'/is', $code, $match); |
314 | - for($k=0; $k<count($match[0]); $k++) |
|
315 | - $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
331 | + for($k=0; $k<count($match[0]); $k++) { |
|
332 | + $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
333 | + } |
|
316 | 334 | |
317 | 335 | // read the parameters : nom="valeur" |
318 | 336 | $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]'; |
319 | 337 | preg_match_all('/'.$prop.'/is', $code, $match); |
320 | - for($k=0; $k<count($match[0]); $k++) |
|
321 | - $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
338 | + for($k=0; $k<count($match[0]); $k++) { |
|
339 | + $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
340 | + } |
|
322 | 341 | |
323 | 342 | // read the parameters : nom='valeur' |
324 | 343 | $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']"; |
325 | 344 | preg_match_all('/'.$prop.'/is', $code, $match); |
326 | - for($k=0; $k<count($match[0]); $k++) |
|
327 | - $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
345 | + for($k=0; $k<count($match[0]); $k++) { |
|
346 | + $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
347 | + } |
|
328 | 348 | |
329 | 349 | // compliance of each parameter |
330 | 350 | $color = "#000000"; |
@@ -370,19 +390,25 @@ discard block |
||
370 | 390 | |
371 | 391 | case 'border': |
372 | 392 | unset($param[$key]); |
373 | - if (preg_match('/^[0-9]+$/isU', $val)) $val = $val.'px'; |
|
393 | + if (preg_match('/^[0-9]+$/isU', $val)) { |
|
394 | + $val = $val.'px'; |
|
395 | + } |
|
374 | 396 | $border = $val; |
375 | 397 | break; |
376 | 398 | |
377 | 399 | case 'cellpadding': |
378 | 400 | case 'cellspacing': |
379 | - if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px'; |
|
401 | + if (preg_match('/^([0-9]+)$/isU', $val)) { |
|
402 | + $param[$key] = $val.'px'; |
|
403 | + } |
|
380 | 404 | break; |
381 | 405 | |
382 | 406 | case 'colspan': |
383 | 407 | case 'rowspan': |
384 | 408 | $val = preg_replace('/[^0-9]/isU', '', $val); |
385 | - if (!$val) $val = 1; |
|
409 | + if (!$val) { |
|
410 | + $val = 1; |
|
411 | + } |
|
386 | 412 | $param[$key] = $val; |
387 | 413 | break; |
388 | 414 | } |
@@ -390,8 +416,11 @@ discard block |
||
390 | 416 | |
391 | 417 | // compliance of the border |
392 | 418 | if ($border!==null) { |
393 | - if ($border) $border = 'border: solid '.$border.' '.$color; |
|
394 | - else $border = 'border: none'; |
|
419 | + if ($border) { |
|
420 | + $border = 'border: solid '.$border.' '.$color; |
|
421 | + } else { |
|
422 | + $border = 'border: none'; |
|
423 | + } |
|
395 | 424 | |
396 | 425 | $param['style'] .= $border.'; '; |
397 | 426 | $param['border'] = $border; |
@@ -427,10 +456,18 @@ discard block |
||
427 | 456 | } |
428 | 457 | |
429 | 458 | // prepare the parameters |
430 | - if (isset($param['value'])) $param['value'] = $this->_prepareTxt($param['value']); |
|
431 | - if (isset($param['alt'])) $param['alt'] = $this->_prepareTxt($param['alt']); |
|
432 | - if (isset($param['title'])) $param['title'] = $this->_prepareTxt($param['title']); |
|
433 | - if (isset($param['class'])) $param['class'] = $this->_prepareTxt($param['class']); |
|
459 | + if (isset($param['value'])) { |
|
460 | + $param['value'] = $this->_prepareTxt($param['value']); |
|
461 | + } |
|
462 | + if (isset($param['alt'])) { |
|
463 | + $param['alt'] = $this->_prepareTxt($param['alt']); |
|
464 | + } |
|
465 | + if (isset($param['title'])) { |
|
466 | + $param['title'] = $this->_prepareTxt($param['title']); |
|
467 | + } |
|
468 | + if (isset($param['class'])) { |
|
469 | + $param['class'] = $this->_prepareTxt($param['class']); |
|
470 | + } |
|
434 | 471 | |
435 | 472 | // return the new action to do |
436 | 473 | return array('name' => $name, 'close' => $close ? 1 : 0, 'autoclose' => $autoclose, 'param' => $param); |
@@ -445,7 +482,9 @@ discard block |
||
445 | 482 | public function getLevel($k) |
446 | 483 | { |
447 | 484 | // if the code does not exist => return empty |
448 | - if (!isset($this->code[$k])) return array(); |
|
485 | + if (!isset($this->code[$k])) { |
|
486 | + return array(); |
|
487 | + } |
|
449 | 488 | |
450 | 489 | // the tag to detect |
451 | 490 | $detect = $this->code[$k]['name']; |
@@ -490,16 +529,19 @@ discard block |
||
490 | 529 | |
491 | 530 | // if we can takin into account the current tag => save it |
492 | 531 | if (!$not) { |
493 | - if (isset($row['style']['text-align'])) unset($row['style']['text-align']); |
|
532 | + if (isset($row['style']['text-align'])) { |
|
533 | + unset($row['style']['text-align']); |
|
534 | + } |
|
494 | 535 | $code[] = $row; |
495 | 536 | } |
496 | 537 | } |
497 | 538 | |
498 | 539 | // it continues as long as there has code to analise |
499 | - if (isset($this->code[$k+1])) |
|
500 | - $k++; |
|
501 | - else |
|
502 | - $end = true; |
|
540 | + if (isset($this->code[$k+1])) { |
|
541 | + $k++; |
|
542 | + } else { |
|
543 | + $end = true; |
|
544 | + } |
|
503 | 545 | } |
504 | 546 | |
505 | 547 | // return the extract |
@@ -552,8 +552,12 @@ discard block |
||
552 | 552 | public function setRotation($angle, $xC=null, $yC=null) |
553 | 553 | { |
554 | 554 | // if no center, rotate around the current posiition |
555 | - if($xC === null) $xC=$this->x; |
|
556 | - if($yC === null) $yC=$this->y; |
|
555 | + if($xC === null) { |
|
556 | + $xC=$this->x; |
|
557 | + } |
|
558 | + if($yC === null) { |
|
559 | + $yC=$this->y; |
|
560 | + } |
|
557 | 561 | |
558 | 562 | // prepare the coordinate |
559 | 563 | $yC=($this->h-$yC)*$this->k; |
@@ -595,8 +599,9 @@ discard block |
||
595 | 599 | */ |
596 | 600 | public function SetY($y, $resetx=true, $rtloff=false) |
597 | 601 | { |
598 | - if ($resetx) |
|
599 | - $this->x=$this->lMargin; |
|
602 | + if ($resetx) { |
|
603 | + $this->x=$this->lMargin; |
|
604 | + } |
|
600 | 605 | |
601 | 606 | $this->y=$y; |
602 | 607 | } |
@@ -713,9 +718,13 @@ discard block |
||
713 | 718 | $y4=$y+$h; |
714 | 719 | |
715 | 720 | // get the Closing operator from the PDF Style |
716 | - if($style=='F') $op='f'; |
|
717 | - elseif($style=='FD' || $style=='DF') $op='B'; |
|
718 | - else $op='S'; |
|
721 | + if($style=='F') { |
|
722 | + $op='f'; |
|
723 | + } elseif($style=='FD' || $style=='DF') { |
|
724 | + $op='B'; |
|
725 | + } else { |
|
726 | + $op='S'; |
|
727 | + } |
|
719 | 728 | |
720 | 729 | // drawing |
721 | 730 | $this->_Point($x1, $y1, true); |
@@ -759,9 +768,13 @@ discard block |
||
759 | 768 | public function svgEllipse($x0, $y0, $rx, $ry, $style) |
760 | 769 | { |
761 | 770 | // get the Closing operator from the PDF Style |
762 | - if($style=='F') $op='f'; |
|
763 | - elseif($style=='FD' || $style=='DF') $op='B'; |
|
764 | - else $op='S'; |
|
771 | + if($style=='F') { |
|
772 | + $op='f'; |
|
773 | + } elseif($style=='FD' || $style=='DF') { |
|
774 | + $op='B'; |
|
775 | + } else { |
|
776 | + $op='S'; |
|
777 | + } |
|
765 | 778 | |
766 | 779 | // drawing |
767 | 780 | $this->_Arc($x0, $y0, $rx, $ry, 0, 2*M_PI, true, true, true); |
@@ -778,9 +791,13 @@ discard block |
||
778 | 791 | public function svgPolygone($actions, $style) |
779 | 792 | { |
780 | 793 | // get the Closing operator from the PDF Style |
781 | - if($style=='F') $op='f'; |
|
782 | - elseif($style=='FD' || $style=='DF') $op='B'; |
|
783 | - else $op='S'; |
|
794 | + if($style=='F') { |
|
795 | + $op='f'; |
|
796 | + } elseif($style=='FD' || $style=='DF') { |
|
797 | + $op='B'; |
|
798 | + } else { |
|
799 | + $op='S'; |
|
800 | + } |
|
784 | 801 | |
785 | 802 | // To save the First action and the last point |
786 | 803 | $first = array('', 0, 0); |
@@ -919,7 +936,9 @@ discard block |
||
919 | 936 | */ |
920 | 937 | protected function _Point($x, $y, $trans = false) |
921 | 938 | { |
922 | - if ($trans) $this->ptTransform($x, $y); |
|
939 | + if ($trans) { |
|
940 | + $this->ptTransform($x, $y); |
|
941 | + } |
|
923 | 942 | |
924 | 943 | $this->_out(sprintf('%.2F %.2F m', $x, $y)); |
925 | 944 | } |
@@ -934,7 +953,9 @@ discard block |
||
934 | 953 | */ |
935 | 954 | protected function _Line($x, $y, $trans = false) |
936 | 955 | { |
937 | - if ($trans) $this->ptTransform($x, $y); |
|
956 | + if ($trans) { |
|
957 | + $this->ptTransform($x, $y); |
|
958 | + } |
|
938 | 959 | |
939 | 960 | $this->_out(sprintf('%.2F %.2F l', $x, $y)); |
940 | 961 | } |
@@ -987,7 +1008,9 @@ discard block |
||
987 | 1008 | $trans=false) |
988 | 1009 | { |
989 | 1010 | // if we want the no trigo direction : add 2PI to the begin angle, to invert the direction |
990 | - if (!$direction) $angleBegin+= M_PI*2.; |
|
1011 | + if (!$direction) { |
|
1012 | + $angleBegin+= M_PI*2.; |
|
1013 | + } |
|
991 | 1014 | |
992 | 1015 | // cut in segment to convert in berize curv |
993 | 1016 | $dt = ($angleEnd - $angleBegin)/self::ARC_NB_SEGMENT; |
@@ -1004,7 +1027,9 @@ discard block |
||
1004 | 1027 | $d0 = $ry * cos($t1); |
1005 | 1028 | |
1006 | 1029 | // if drawFirst => draw the first point |
1007 | - if ($drawFirst) $this->_Point($a0, $b0, $trans); |
|
1030 | + if ($drawFirst) { |
|
1031 | + $this->_Point($a0, $b0, $trans); |
|
1032 | + } |
|
1008 | 1033 | |
1009 | 1034 | // foreach segment |
1010 | 1035 | for ($i = 1; $i <= self::ARC_NB_SEGMENT; $i++) { |
@@ -1091,7 +1116,9 @@ discard block |
||
1091 | 1116 | $v['s1']['y'] =-$v['s1']['xr']*sin($angle)+$v['s1']['yr']*cos($angle); |
1092 | 1117 | $v['s1']['a1'] = atan2($v['y1']-$v['s1']['y'], $v['x1']-$v['s1']['x']); |
1093 | 1118 | $v['s1']['a2'] = atan2($v['y2']-$v['s1']['y'], $v['x2']-$v['s1']['x']); |
1094 | - if ($v['s1']['a1']>$v['s1']['a2']) $v['s1']['a1']-=2*M_PI; |
|
1119 | + if ($v['s1']['a1']>$v['s1']['a2']) { |
|
1120 | + $v['s1']['a1']-=2*M_PI; |
|
1121 | + } |
|
1095 | 1122 | |
1096 | 1123 | $v['s2'] = array(); |
1097 | 1124 | $v['s2']['t'] = -$v['s1']['t']; |
@@ -1103,7 +1130,9 @@ discard block |
||
1103 | 1130 | $v['s2']['y'] =-$v['s2']['xr']*sin($angle)+$v['s2']['yr']*cos($angle); |
1104 | 1131 | $v['s2']['a1'] = atan2($v['y1']-$v['s2']['y'], $v['x1']-$v['s2']['x']); |
1105 | 1132 | $v['s2']['a2'] = atan2($v['y2']-$v['s2']['y'], $v['x2']-$v['s2']['x']); |
1106 | - if ($v['s2']['a1']>$v['s2']['a2']) $v['s2']['a1']-=2*M_PI; |
|
1133 | + if ($v['s2']['a1']>$v['s2']['a2']) { |
|
1134 | + $v['s2']['a1']-=2*M_PI; |
|
1135 | + } |
|
1107 | 1136 | |
1108 | 1137 | if (!$l) { |
1109 | 1138 | if ($s) { |
@@ -1149,8 +1178,11 @@ discard block |
||
1149 | 1178 | { |
1150 | 1179 | // load the last Transfomation Matrix |
1151 | 1180 | $nb = count($this->_transf); |
1152 | - if ($nb) $m = $this->_transf[$nb-1]; |
|
1153 | - else $m = array(1,0,0,1,0,0); |
|
1181 | + if ($nb) { |
|
1182 | + $m = $this->_transf[$nb-1]; |
|
1183 | + } else { |
|
1184 | + $m = array(1,0,0,1,0,0); |
|
1185 | + } |
|
1154 | 1186 | |
1155 | 1187 | // apply the Transformation Matrix |
1156 | 1188 | list($x,$y) = array(($x*$m[0]+$y*$m[2]+$m[4]),($x*$m[1]+$y*$m[3]+$m[5])); |
@@ -1174,11 +1206,16 @@ discard block |
||
1174 | 1206 | { |
1175 | 1207 | // get the last Transformation Matrix |
1176 | 1208 | $nb = count($this->_transf); |
1177 | - if ($nb) $m = $this->_transf[$nb-1]; |
|
1178 | - else $m = array(1,0,0,1,0,0); |
|
1209 | + if ($nb) { |
|
1210 | + $m = $this->_transf[$nb-1]; |
|
1211 | + } else { |
|
1212 | + $m = array(1,0,0,1,0,0); |
|
1213 | + } |
|
1179 | 1214 | |
1180 | 1215 | // if no transform, get the Identity Matrix |
1181 | - if (!$n) $n = array(1,0,0,1,0,0); |
|
1216 | + if (!$n) { |
|
1217 | + $n = array(1,0,0,1,0,0); |
|
1218 | + } |
|
1182 | 1219 | |
1183 | 1220 | // create the new Transformation Matrix |
1184 | 1221 | $this->_transf[] = array( |
@@ -1228,7 +1265,9 @@ discard block |
||
1228 | 1265 | $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N'); |
1229 | 1266 | |
1230 | 1267 | // it Label => add the FontSize to the height |
1231 | - if ($labelFontsize) $h+= ($labelFontsize); |
|
1268 | + if ($labelFontsize) { |
|
1269 | + $h+= ($labelFontsize); |
|
1270 | + } |
|
1232 | 1271 | |
1233 | 1272 | // return the size of the barcode |
1234 | 1273 | return array($w, $h); |
@@ -1258,7 +1297,9 @@ discard block |
||
1258 | 1297 | $fontName = 'helvetica') |
1259 | 1298 | { |
1260 | 1299 | // bookmark the Title if wanted |
1261 | - if ($bookmarkTitle) $this->Bookmark($titre, 0, -1); |
|
1300 | + if ($bookmarkTitle) { |
|
1301 | + $this->Bookmark($titre, 0, -1); |
|
1302 | + } |
|
1262 | 1303 | |
1263 | 1304 | // display the Title with the good Font size |
1264 | 1305 | $this->SetFont($fontName, '', $sizeTitle); |
@@ -1284,7 +1325,9 @@ discard block |
||
1284 | 1325 | |
1285 | 1326 | // Offset of the current level |
1286 | 1327 | $level=$this->outlines[$i]['l']; |
1287 | - if($level>0) $this->Cell($level*8); |
|
1328 | + if($level>0) { |
|
1329 | + $this->Cell($level*8); |
|
1330 | + } |
|
1288 | 1331 | |
1289 | 1332 | // Caption (cut to fit on the width page) |
1290 | 1333 | $str=$this->outlines[$i]['t']; |
@@ -82,7 +82,9 @@ discard block |
||
82 | 82 | { |
83 | 83 | $old = $this->_defaultFont; |
84 | 84 | $this->_defaultFont = $default; |
85 | - if ($default) $this->value['font-family'] = $default; |
|
85 | + if ($default) { |
|
86 | + $this->value['font-family'] = $default; |
|
87 | + } |
|
86 | 88 | return $old; |
87 | 89 | } |
88 | 90 | |
@@ -179,7 +181,9 @@ discard block |
||
179 | 181 | |
180 | 182 | // prepare the Collapse attribute |
181 | 183 | $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false; |
182 | - if (!in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) $collapse = false; |
|
184 | + if (!in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) { |
|
185 | + $collapse = false; |
|
186 | + } |
|
183 | 187 | |
184 | 188 | // set the global css values |
185 | 189 | $this->value['position'] = null; |
@@ -315,20 +319,23 @@ discard block |
||
315 | 319 | $style = $b.$i; |
316 | 320 | |
317 | 321 | if ($this->_defaultFont) { |
318 | - if($family=='arial') |
|
319 | - $family='helvetica'; |
|
320 | - elseif($family=='symbol' || $family=='zapfdingbats') |
|
321 | - $style=''; |
|
322 | + if($family=='arial') { |
|
323 | + $family='helvetica'; |
|
324 | + } elseif($family=='symbol' || $family=='zapfdingbats') { |
|
325 | + $style=''; |
|
326 | + } |
|
322 | 327 | |
323 | 328 | $fontkey = $family.$style; |
324 | - if (!$this->_pdf->isLoadedFont($fontkey)) |
|
325 | - $family = $this->_defaultFont; |
|
329 | + if (!$this->_pdf->isLoadedFont($fontkey)) { |
|
330 | + $family = $this->_defaultFont; |
|
331 | + } |
|
326 | 332 | } |
327 | 333 | |
328 | - if($family=='arial') |
|
329 | - $family='helvetica'; |
|
330 | - elseif($family=='symbol' || $family=='zapfdingbats') |
|
331 | - $style=''; |
|
334 | + if($family=='arial') { |
|
335 | + $family='helvetica'; |
|
336 | + } elseif($family=='symbol' || $family=='zapfdingbats') { |
|
337 | + $style=''; |
|
338 | + } |
|
332 | 339 | |
333 | 340 | // complete style |
334 | 341 | $style.= $u.$d.$o; |
@@ -340,10 +347,11 @@ discard block |
||
340 | 347 | // apply the font |
341 | 348 | $this->_pdf->SetFont($family, $style, $this->value['mini-size']*$size); |
342 | 349 | $this->_pdf->setTextColorArray($this->value['color']); |
343 | - if ($this->value['background']['color']) |
|
344 | - $this->_pdf->setFillColorArray($this->value['background']['color']); |
|
345 | - else |
|
346 | - $this->_pdf->setFillColor(255); |
|
350 | + if ($this->value['background']['color']) { |
|
351 | + $this->_pdf->setFillColorArray($this->value['background']['color']); |
|
352 | + } else { |
|
353 | + $this->_pdf->setFillColor(255); |
|
354 | + } |
|
347 | 355 | } |
348 | 356 | |
349 | 357 | /** |
@@ -375,7 +383,9 @@ discard block |
||
375 | 383 | */ |
376 | 384 | public function restorePosition() |
377 | 385 | { |
378 | - if ($this->value['y']==$this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false); |
|
386 | + if ($this->value['y']==$this->_pdf->getY()) { |
|
387 | + $this->_pdf->setY($this->value['yc'], false); |
|
388 | + } |
|
379 | 389 | } |
380 | 390 | |
381 | 391 | /** |
@@ -396,18 +406,26 @@ discard block |
||
396 | 406 | if ($this->value['position']=='relative' || $this->value['position']=='absolute') { |
397 | 407 | if ($this->value['right']!==null) { |
398 | 408 | $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width']; |
399 | - if ($this->value['margin']['r']) $x-= $this->value['margin']['r']; |
|
409 | + if ($this->value['margin']['r']) { |
|
410 | + $x-= $this->value['margin']['r']; |
|
411 | + } |
|
400 | 412 | } else { |
401 | 413 | $x = $this->value['left']; |
402 | - if ($this->value['margin']['l']) $x+= $this->value['margin']['l']; |
|
414 | + if ($this->value['margin']['l']) { |
|
415 | + $x+= $this->value['margin']['l']; |
|
416 | + } |
|
403 | 417 | } |
404 | 418 | |
405 | 419 | if ($this->value['bottom']!==null) { |
406 | 420 | $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height']; |
407 | - if ($this->value['margin']['b']) $y-= $this->value['margin']['b']; |
|
421 | + if ($this->value['margin']['b']) { |
|
422 | + $y-= $this->value['margin']['b']; |
|
423 | + } |
|
408 | 424 | } else { |
409 | 425 | $y = $this->value['top']; |
410 | - if ($this->value['margin']['t']) $y+= $this->value['margin']['t']; |
|
426 | + if ($this->value['margin']['t']) { |
|
427 | + $y+= $this->value['margin']['t']; |
|
428 | + } |
|
411 | 429 | } |
412 | 430 | |
413 | 431 | if ($this->value['position']=='relative') { |
@@ -420,8 +438,12 @@ discard block |
||
420 | 438 | } else { |
421 | 439 | $this->value['x'] = $currentX; |
422 | 440 | $this->value['y'] = $currentY; |
423 | - if ($this->value['margin']['l']) $this->value['x']+= $this->value['margin']['l']; |
|
424 | - if ($this->value['margin']['t']) $this->value['y']+= $this->value['margin']['t']; |
|
441 | + if ($this->value['margin']['l']) { |
|
442 | + $this->value['x']+= $this->value['margin']['l']; |
|
443 | + } |
|
444 | + if ($this->value['margin']['t']) { |
|
445 | + $this->value['y']+= $this->value['margin']['t']; |
|
446 | + } |
|
425 | 447 | } |
426 | 448 | |
427 | 449 | // save the new position |
@@ -478,8 +500,12 @@ discard block |
||
478 | 500 | { |
479 | 501 | // prepare |
480 | 502 | $tagName = strtolower($tagName); |
481 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if (!$id) $id = null; |
|
482 | - $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) $name = null; |
|
503 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if (!$id) { |
|
504 | + $id = null; |
|
505 | + } |
|
506 | + $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) { |
|
507 | + $name = null; |
|
508 | + } |
|
483 | 509 | |
484 | 510 | // read the class attribute |
485 | 511 | $class = array(); |
@@ -487,7 +513,9 @@ discard block |
||
487 | 513 | $tmp = explode(' ', $tmp); |
488 | 514 | foreach ($tmp as $k => $v) { |
489 | 515 | $v = trim($v); |
490 | - if ($v) $class[] = $v; |
|
516 | + if ($v) { |
|
517 | + $class[] = $v; |
|
518 | + } |
|
491 | 519 | } |
492 | 520 | |
493 | 521 | // identify the tag, and the direct styles |
@@ -526,10 +554,18 @@ discard block |
||
526 | 554 | // adding the style from the tag |
527 | 555 | $styles = array_merge($styles, $param['style']); |
528 | 556 | |
529 | - if (isset($styles['stroke'])) $this->value['svg']['stroke'] = $this->convertToColor($styles['stroke'], $res); |
|
530 | - if (isset($styles['stroke-width'])) $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']); |
|
531 | - if (isset($styles['fill'])) $this->value['svg']['fill'] = $this->convertToColor($styles['fill'], $res); |
|
532 | - if (isset($styles['fill-opacity'])) $this->value['svg']['fill-opacity'] = 1.*$styles['fill-opacity']; |
|
557 | + if (isset($styles['stroke'])) { |
|
558 | + $this->value['svg']['stroke'] = $this->convertToColor($styles['stroke'], $res); |
|
559 | + } |
|
560 | + if (isset($styles['stroke-width'])) { |
|
561 | + $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']); |
|
562 | + } |
|
563 | + if (isset($styles['fill'])) { |
|
564 | + $this->value['svg']['fill'] = $this->convertToColor($styles['fill'], $res); |
|
565 | + } |
|
566 | + if (isset($styles['fill-opacity'])) { |
|
567 | + $this->value['svg']['fill-opacity'] = 1.*$styles['fill-opacity']; |
|
568 | + } |
|
533 | 569 | |
534 | 570 | return $this->value['svg']; |
535 | 571 | } |
@@ -546,8 +582,12 @@ discard block |
||
546 | 582 | { |
547 | 583 | // prepare the informations |
548 | 584 | $tagName = strtolower($tagName); |
549 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if (!$id) $id = null; |
|
550 | - $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) $name = null; |
|
585 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if (!$id) { |
|
586 | + $id = null; |
|
587 | + } |
|
588 | + $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) { |
|
589 | + $name = null; |
|
590 | + } |
|
551 | 591 | |
552 | 592 | // get the class names to use |
553 | 593 | $class = array(); |
@@ -555,7 +595,9 @@ discard block |
||
555 | 595 | $tmp = explode(' ', $tmp); |
556 | 596 | foreach ($tmp as $k => $v) { |
557 | 597 | $v = trim($v); |
558 | - if ($v) $class[] = $v; |
|
598 | + if ($v) { |
|
599 | + $class[] = $v; |
|
600 | + } |
|
559 | 601 | } |
560 | 602 | |
561 | 603 | // prepare the values, and the list of css tags to identify |
@@ -584,7 +626,9 @@ discard block |
||
584 | 626 | |
585 | 627 | // merge with the css styles from tag |
586 | 628 | $styles = array_merge($styles, $param['style']); |
587 | - if (isset($param['allwidth']) && !isset($styles['width'])) $styles['width'] = '100%'; |
|
629 | + if (isset($param['allwidth']) && !isset($styles['width'])) { |
|
630 | + $styles['width'] = '100%'; |
|
631 | + } |
|
588 | 632 | |
589 | 633 | // reset some styles, depending on the tag name |
590 | 634 | $this->resetStyle($tagName); |
@@ -593,8 +637,9 @@ discard block |
||
593 | 637 | if ($legacy) { |
594 | 638 | foreach ($legacy as $legacyName => $legacyValue) { |
595 | 639 | if (is_array($legacyValue)) { |
596 | - foreach($legacyValue as $legacy2Name => $legacy2Value) |
|
597 | - $this->value[$legacyName][$legacy2Name] = $legacy2Value; |
|
640 | + foreach($legacyValue as $legacy2Name => $legacy2Value) { |
|
641 | + $this->value[$legacyName][$legacy2Name] = $legacy2Value; |
|
642 | + } |
|
598 | 643 | } else { |
599 | 644 | $this->value[$legacyName] = $legacyValue; |
600 | 645 | } |
@@ -612,7 +657,9 @@ discard block |
||
612 | 657 | case 'font-family': |
613 | 658 | $val = explode(',', $val); |
614 | 659 | $val = trim($val[0]); |
615 | - if ($val) $this->value['font-family'] = $val; |
|
660 | + if ($val) { |
|
661 | + $this->value['font-family'] = $val; |
|
662 | + } |
|
616 | 663 | break; |
617 | 664 | |
618 | 665 | case 'font-weight': |
@@ -635,13 +682,17 @@ discard block |
||
635 | 682 | break; |
636 | 683 | |
637 | 684 | case 'text-transform': |
638 | - if (!in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none'; |
|
685 | + if (!in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) { |
|
686 | + $val = 'none'; |
|
687 | + } |
|
639 | 688 | $this->value['text-transform'] = $val; |
640 | 689 | break; |
641 | 690 | |
642 | 691 | case 'font-size': |
643 | 692 | $val = $this->convertToMM($val, $this->value['font-size']); |
644 | - if ($val) $this->value['font-size'] = $val; |
|
693 | + if ($val) { |
|
694 | + $this->value['font-size'] = $val; |
|
695 | + } |
|
645 | 696 | break; |
646 | 697 | |
647 | 698 | case 'color': |
@@ -657,7 +708,9 @@ discard block |
||
657 | 708 | |
658 | 709 | case 'text-align': |
659 | 710 | $val = strtolower($val); |
660 | - if (!in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) $val = 'left'; |
|
711 | + if (!in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) { |
|
712 | + $val = 'left'; |
|
713 | + } |
|
661 | 714 | $this->value['text-align'] = $val; |
662 | 715 | break; |
663 | 716 | |
@@ -667,7 +720,9 @@ discard block |
||
667 | 720 | |
668 | 721 | case 'width': |
669 | 722 | $this->value['width'] = $this->convertToMM($val, $this->getLastWidth()); |
670 | - if ($this->value['width'] && substr($val, -1)=='%') $correctWidth=true; |
|
723 | + if ($this->value['width'] && substr($val, -1)=='%') { |
|
724 | + $correctWidth=true; |
|
725 | + } |
|
671 | 726 | $noWidth = false; |
672 | 727 | break; |
673 | 728 | |
@@ -676,18 +731,26 @@ discard block |
||
676 | 731 | break; |
677 | 732 | |
678 | 733 | case 'line-height': |
679 | - if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val*100).'%'; |
|
734 | + if (preg_match('/^[0-9\.]+$/isU', $val)) { |
|
735 | + $val = floor($val*100).'%'; |
|
736 | + } |
|
680 | 737 | $this->value['line-height'] = $val; |
681 | 738 | break; |
682 | 739 | |
683 | 740 | case 'rotate': |
684 | - if (!in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null; |
|
685 | - if ($val<0) $val+= 360; |
|
741 | + if (!in_array($val, array(0, -90, 90, 180, 270, -180, -270))) { |
|
742 | + $val = null; |
|
743 | + } |
|
744 | + if ($val<0) { |
|
745 | + $val+= 360; |
|
746 | + } |
|
686 | 747 | $this->value['rotate'] = $val; |
687 | 748 | break; |
688 | 749 | |
689 | 750 | case 'overflow': |
690 | - if (!in_array($val, array('visible', 'hidden'))) $val = 'visible'; |
|
751 | + if (!in_array($val, array('visible', 'hidden'))) { |
|
752 | + $val = 'visible'; |
|
753 | + } |
|
691 | 754 | $this->value['overflow'] = $val; |
692 | 755 | break; |
693 | 756 | |
@@ -779,10 +842,18 @@ discard block |
||
779 | 842 | } |
780 | 843 | } |
781 | 844 | $this->_duplicateBorder($val); |
782 | - if ($val[0]) $this->value['border']['t']['type'] = $val[0]; |
|
783 | - if ($val[1]) $this->value['border']['r']['type'] = $val[1]; |
|
784 | - if ($val[2]) $this->value['border']['b']['type'] = $val[2]; |
|
785 | - if ($val[3]) $this->value['border']['l']['type'] = $val[3]; |
|
845 | + if ($val[0]) { |
|
846 | + $this->value['border']['t']['type'] = $val[0]; |
|
847 | + } |
|
848 | + if ($val[1]) { |
|
849 | + $this->value['border']['r']['type'] = $val[1]; |
|
850 | + } |
|
851 | + if ($val[2]) { |
|
852 | + $this->value['border']['b']['type'] = $val[2]; |
|
853 | + } |
|
854 | + if ($val[3]) { |
|
855 | + $this->value['border']['l']['type'] = $val[3]; |
|
856 | + } |
|
786 | 857 | break; |
787 | 858 | |
788 | 859 | case 'border-top-style': |
@@ -804,8 +875,9 @@ discard block |
||
804 | 875 | break; |
805 | 876 | |
806 | 877 | case 'border-left-style': |
807 | - if (in_array($val, array('solid', 'dotted', 'dashed'))) |
|
808 | - $this->value['border']['l']['type'] = $val; |
|
878 | + if (in_array($val, array('solid', 'dotted', 'dashed'))) { |
|
879 | + $this->value['border']['l']['type'] = $val; |
|
880 | + } |
|
809 | 881 | break; |
810 | 882 | |
811 | 883 | case 'border-color': |
@@ -819,35 +891,51 @@ discard block |
||
819 | 891 | } |
820 | 892 | } |
821 | 893 | $this->_duplicateBorder($val); |
822 | - if (is_array($val[0])) $this->value['border']['t']['color'] = $val[0]; |
|
823 | - if (is_array($val[1])) $this->value['border']['r']['color'] = $val[1]; |
|
824 | - if (is_array($val[2])) $this->value['border']['b']['color'] = $val[2]; |
|
825 | - if (is_array($val[3])) $this->value['border']['l']['color'] = $val[3]; |
|
894 | + if (is_array($val[0])) { |
|
895 | + $this->value['border']['t']['color'] = $val[0]; |
|
896 | + } |
|
897 | + if (is_array($val[1])) { |
|
898 | + $this->value['border']['r']['color'] = $val[1]; |
|
899 | + } |
|
900 | + if (is_array($val[2])) { |
|
901 | + $this->value['border']['b']['color'] = $val[2]; |
|
902 | + } |
|
903 | + if (is_array($val[3])) { |
|
904 | + $this->value['border']['l']['color'] = $val[3]; |
|
905 | + } |
|
826 | 906 | |
827 | 907 | break; |
828 | 908 | |
829 | 909 | case 'border-top-color': |
830 | 910 | $res = false; |
831 | 911 | $val = $this->convertToColor($val, $res); |
832 | - if ($res) $this->value['border']['t']['color'] = $val; |
|
912 | + if ($res) { |
|
913 | + $this->value['border']['t']['color'] = $val; |
|
914 | + } |
|
833 | 915 | break; |
834 | 916 | |
835 | 917 | case 'border-right-color': |
836 | 918 | $res = false; |
837 | 919 | $val = $this->convertToColor($val, $res); |
838 | - if ($res) $this->value['border']['r']['color'] = $val; |
|
920 | + if ($res) { |
|
921 | + $this->value['border']['r']['color'] = $val; |
|
922 | + } |
|
839 | 923 | break; |
840 | 924 | |
841 | 925 | case 'border-bottom-color': |
842 | 926 | $res = false; |
843 | 927 | $val = $this->convertToColor($val, $res); |
844 | - if ($res) $this->value['border']['b']['color'] = $val; |
|
928 | + if ($res) { |
|
929 | + $this->value['border']['b']['color'] = $val; |
|
930 | + } |
|
845 | 931 | break; |
846 | 932 | |
847 | 933 | case 'border-left-color': |
848 | 934 | $res = false; |
849 | 935 | $val = $this->convertToColor($val, $res); |
850 | - if ($res) $this->value['border']['l']['color'] = $val; |
|
936 | + if ($res) { |
|
937 | + $this->value['border']['l']['color'] = $val; |
|
938 | + } |
|
851 | 939 | break; |
852 | 940 | |
853 | 941 | case 'border-width': |
@@ -856,34 +944,52 @@ discard block |
||
856 | 944 | $val[$valK] = $this->convertToMM($valV, 0); |
857 | 945 | } |
858 | 946 | $this->_duplicateBorder($val); |
859 | - if ($val[0]) $this->value['border']['t']['width'] = $val[0]; |
|
860 | - if ($val[1]) $this->value['border']['r']['width'] = $val[1]; |
|
861 | - if ($val[2]) $this->value['border']['b']['width'] = $val[2]; |
|
862 | - if ($val[3]) $this->value['border']['l']['width'] = $val[3]; |
|
947 | + if ($val[0]) { |
|
948 | + $this->value['border']['t']['width'] = $val[0]; |
|
949 | + } |
|
950 | + if ($val[1]) { |
|
951 | + $this->value['border']['r']['width'] = $val[1]; |
|
952 | + } |
|
953 | + if ($val[2]) { |
|
954 | + $this->value['border']['b']['width'] = $val[2]; |
|
955 | + } |
|
956 | + if ($val[3]) { |
|
957 | + $this->value['border']['l']['width'] = $val[3]; |
|
958 | + } |
|
863 | 959 | break; |
864 | 960 | |
865 | 961 | case 'border-top-width': |
866 | 962 | $val = $this->convertToMM($val, 0); |
867 | - if ($val) $this->value['border']['t']['width'] = $val; |
|
963 | + if ($val) { |
|
964 | + $this->value['border']['t']['width'] = $val; |
|
965 | + } |
|
868 | 966 | break; |
869 | 967 | |
870 | 968 | case 'border-right-width': |
871 | 969 | $val = $this->convertToMM($val, 0); |
872 | - if ($val) $this->value['border']['r']['width'] = $val; |
|
970 | + if ($val) { |
|
971 | + $this->value['border']['r']['width'] = $val; |
|
972 | + } |
|
873 | 973 | break; |
874 | 974 | |
875 | 975 | case 'border-bottom-width': |
876 | 976 | $val = $this->convertToMM($val, 0); |
877 | - if ($val) $this->value['border']['b']['width'] = $val; |
|
977 | + if ($val) { |
|
978 | + $this->value['border']['b']['width'] = $val; |
|
979 | + } |
|
878 | 980 | break; |
879 | 981 | |
880 | 982 | case 'border-left-width': |
881 | 983 | $val = $this->convertToMM($val, 0); |
882 | - if ($val) $this->value['border']['l']['width'] = $val; |
|
984 | + if ($val) { |
|
985 | + $this->value['border']['l']['width'] = $val; |
|
986 | + } |
|
883 | 987 | break; |
884 | 988 | |
885 | 989 | case 'border-collapse': |
886 | - if ($tagName=='table') $this->value['border']['collapse'] = ($val=='collapse'); |
|
990 | + if ($tagName=='table') { |
|
991 | + $this->value['border']['collapse'] = ($val=='collapse'); |
|
992 | + } |
|
887 | 993 | break; |
888 | 994 | |
889 | 995 | case 'border-radius': |
@@ -895,17 +1001,29 @@ discard block |
||
895 | 1001 | if (count($valH)<1 || count($valH)>4) { |
896 | 1002 | break; |
897 | 1003 | } |
898 | - if (!isset($valH[1])) $valH[1] = $valH[0]; |
|
899 | - if (!isset($valH[2])) $valH = array($valH[0], $valH[0], $valH[1], $valH[1]); |
|
900 | - if (!isset($valH[3])) $valH[3] = $valH[1]; |
|
1004 | + if (!isset($valH[1])) { |
|
1005 | + $valH[1] = $valH[0]; |
|
1006 | + } |
|
1007 | + if (!isset($valH[2])) { |
|
1008 | + $valH = array($valH[0], $valH[0], $valH[1], $valH[1]); |
|
1009 | + } |
|
1010 | + if (!isset($valH[3])) { |
|
1011 | + $valH[3] = $valH[1]; |
|
1012 | + } |
|
901 | 1013 | if (isset($val[1])) { |
902 | 1014 | $valV = $this->convertToRadius(trim($val[1])); |
903 | 1015 | if (count($valV)<1 || count($valV)>4) { |
904 | 1016 | break; |
905 | 1017 | } |
906 | - if (!isset($valV[1])) $valV[1] = $valV[0]; |
|
907 | - if (!isset($valV[2])) $valV = array($valV[0], $valV[0], $valV[1], $valV[1]); |
|
908 | - if (!isset($valV[3])) $valV[3] = $valV[1]; |
|
1018 | + if (!isset($valV[1])) { |
|
1019 | + $valV[1] = $valV[0]; |
|
1020 | + } |
|
1021 | + if (!isset($valV[2])) { |
|
1022 | + $valV = array($valV[0], $valV[0], $valV[1], $valV[1]); |
|
1023 | + } |
|
1024 | + if (!isset($valV[3])) { |
|
1025 | + $valV[3] = $valV[1]; |
|
1026 | + } |
|
909 | 1027 | } else { |
910 | 1028 | $valV = $valH; |
911 | 1029 | } |
@@ -987,22 +1105,35 @@ discard block |
||
987 | 1105 | break; |
988 | 1106 | |
989 | 1107 | case 'position': |
990 | - if ($val=='absolute') $this->value['position'] = 'absolute'; |
|
991 | - else if ($val=='relative') $this->value['position'] = 'relative'; |
|
992 | - else $this->value['position'] = null; |
|
1108 | + if ($val=='absolute') { |
|
1109 | + $this->value['position'] = 'absolute'; |
|
1110 | + } else if ($val=='relative') { |
|
1111 | + $this->value['position'] = 'relative'; |
|
1112 | + } else { |
|
1113 | + $this->value['position'] = null; |
|
1114 | + } |
|
993 | 1115 | break; |
994 | 1116 | |
995 | 1117 | case 'float': |
996 | - if ($val=='left') $this->value['float'] = 'left'; |
|
997 | - else if ($val=='right') $this->value['float'] = 'right'; |
|
998 | - else $this->value['float'] = null; |
|
1118 | + if ($val=='left') { |
|
1119 | + $this->value['float'] = 'left'; |
|
1120 | + } else if ($val=='right') { |
|
1121 | + $this->value['float'] = 'right'; |
|
1122 | + } else { |
|
1123 | + $this->value['float'] = null; |
|
1124 | + } |
|
999 | 1125 | break; |
1000 | 1126 | |
1001 | 1127 | case 'display': |
1002 | - if ($val=='inline') $this->value['display'] = 'inline'; |
|
1003 | - else if ($val=='block') $this->value['display'] = 'block'; |
|
1004 | - else if ($val=='none') $this->value['display'] = 'none'; |
|
1005 | - else $this->value['display'] = null; |
|
1128 | + if ($val=='inline') { |
|
1129 | + $this->value['display'] = 'inline'; |
|
1130 | + } else if ($val=='block') { |
|
1131 | + $this->value['display'] = 'block'; |
|
1132 | + } else if ($val=='none') { |
|
1133 | + $this->value['display'] = 'none'; |
|
1134 | + } else { |
|
1135 | + $this->value['display'] = null; |
|
1136 | + } |
|
1006 | 1137 | break; |
1007 | 1138 | |
1008 | 1139 | case 'top': |
@@ -1015,7 +1146,9 @@ discard block |
||
1015 | 1146 | case 'list-style': |
1016 | 1147 | case 'list-style-type': |
1017 | 1148 | case 'list-style-image': |
1018 | - if ($nom=='list-style') $nom = 'list-style-type'; |
|
1149 | + if ($nom=='list-style') { |
|
1150 | + $nom = 'list-style-type'; |
|
1151 | + } |
|
1019 | 1152 | $this->value[$nom] = $val; |
1020 | 1153 | break; |
1021 | 1154 | |
@@ -1027,11 +1160,17 @@ discard block |
||
1027 | 1160 | $return = true; |
1028 | 1161 | |
1029 | 1162 | // only for P tag |
1030 | - if ($this->value['margin']['t']===null) $this->value['margin']['t'] = $this->value['font-size']; |
|
1031 | - if ($this->value['margin']['b']===null) $this->value['margin']['b'] = $this->value['font-size']; |
|
1163 | + if ($this->value['margin']['t']===null) { |
|
1164 | + $this->value['margin']['t'] = $this->value['font-size']; |
|
1165 | + } |
|
1166 | + if ($this->value['margin']['b']===null) { |
|
1167 | + $this->value['margin']['b'] = $this->value['font-size']; |
|
1168 | + } |
|
1032 | 1169 | |
1033 | 1170 | // force the text align to left, if asked by html2pdf |
1034 | - if ($this->_onlyLeft) $this->value['text-align'] = 'left'; |
|
1171 | + if ($this->_onlyLeft) { |
|
1172 | + $this->value['text-align'] = 'left'; |
|
1173 | + } |
|
1035 | 1174 | |
1036 | 1175 | // correction on the width (quick box) |
1037 | 1176 | if ($noWidth && in_array($tagName, array('div', 'blockquote', 'fieldset')) && $this->value['position']!='absolute') { |
@@ -1047,30 +1186,60 @@ discard block |
||
1047 | 1186 | $this->value['width']-= $this->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px'); |
1048 | 1187 | $return = false; |
1049 | 1188 | } |
1050 | - if ($this->value['width']<0) $this->value['width']=0; |
|
1189 | + if ($this->value['width']<0) { |
|
1190 | + $this->value['width']=0; |
|
1191 | + } |
|
1051 | 1192 | } else { |
1052 | 1193 | if ($this->value['width']) { |
1053 | - if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width']; |
|
1054 | - if ($this->value['border']['r']['width']) $this->value['width'] += $this->value['border']['r']['width']; |
|
1055 | - if ($this->value['padding']['l']) $this->value['width'] += $this->value['padding']['l']; |
|
1056 | - if ($this->value['padding']['r']) $this->value['width'] += $this->value['padding']['r']; |
|
1194 | + if ($this->value['border']['l']['width']) { |
|
1195 | + $this->value['width'] += $this->value['border']['l']['width']; |
|
1196 | + } |
|
1197 | + if ($this->value['border']['r']['width']) { |
|
1198 | + $this->value['width'] += $this->value['border']['r']['width']; |
|
1199 | + } |
|
1200 | + if ($this->value['padding']['l']) { |
|
1201 | + $this->value['width'] += $this->value['padding']['l']; |
|
1202 | + } |
|
1203 | + if ($this->value['padding']['r']) { |
|
1204 | + $this->value['width'] += $this->value['padding']['r']; |
|
1205 | + } |
|
1057 | 1206 | } |
1058 | 1207 | } |
1059 | 1208 | } |
1060 | 1209 | if ($this->value['height']) { |
1061 | - if ($this->value['border']['b']['width']) $this->value['height'] += $this->value['border']['b']['width']; |
|
1062 | - if ($this->value['border']['t']['width']) $this->value['height'] += $this->value['border']['t']['width']; |
|
1063 | - if ($this->value['padding']['b']) $this->value['height'] += $this->value['padding']['b']; |
|
1064 | - if ($this->value['padding']['t']) $this->value['height'] += $this->value['padding']['t']; |
|
1210 | + if ($this->value['border']['b']['width']) { |
|
1211 | + $this->value['height'] += $this->value['border']['b']['width']; |
|
1212 | + } |
|
1213 | + if ($this->value['border']['t']['width']) { |
|
1214 | + $this->value['height'] += $this->value['border']['t']['width']; |
|
1215 | + } |
|
1216 | + if ($this->value['padding']['b']) { |
|
1217 | + $this->value['height'] += $this->value['padding']['b']; |
|
1218 | + } |
|
1219 | + if ($this->value['padding']['t']) { |
|
1220 | + $this->value['height'] += $this->value['padding']['t']; |
|
1221 | + } |
|
1065 | 1222 | } |
1066 | 1223 | |
1067 | - if ($this->value['top']!=null) $this->value['top'] = $this->convertToMM($this->value['top'], $this->getLastHeight(true)); |
|
1068 | - if ($this->value['bottom']!=null) $this->value['bottom'] = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true)); |
|
1069 | - if ($this->value['left']!=null) $this->value['left'] = $this->convertToMM($this->value['left'], $this->getLastWidth(true)); |
|
1070 | - if ($this->value['right']!=null) $this->value['right'] = $this->convertToMM($this->value['right'], $this->getLastWidth(true)); |
|
1224 | + if ($this->value['top']!=null) { |
|
1225 | + $this->value['top'] = $this->convertToMM($this->value['top'], $this->getLastHeight(true)); |
|
1226 | + } |
|
1227 | + if ($this->value['bottom']!=null) { |
|
1228 | + $this->value['bottom'] = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true)); |
|
1229 | + } |
|
1230 | + if ($this->value['left']!=null) { |
|
1231 | + $this->value['left'] = $this->convertToMM($this->value['left'], $this->getLastWidth(true)); |
|
1232 | + } |
|
1233 | + if ($this->value['right']!=null) { |
|
1234 | + $this->value['right'] = $this->convertToMM($this->value['right'], $this->getLastWidth(true)); |
|
1235 | + } |
|
1071 | 1236 | |
1072 | - if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) $this->value['bottom'] = null; |
|
1073 | - if ($this->value['left'] && $this->value['right'] && $this->value['width']) $this->value['right'] = null; |
|
1237 | + if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) { |
|
1238 | + $this->value['bottom'] = null; |
|
1239 | + } |
|
1240 | + if ($this->value['left'] && $this->value['right'] && $this->value['width']) { |
|
1241 | + $this->value['right'] = null; |
|
1242 | + } |
|
1074 | 1243 | |
1075 | 1244 | return $return; |
1076 | 1245 | } |
@@ -1084,7 +1253,9 @@ discard block |
||
1084 | 1253 | public function getLineHeight() |
1085 | 1254 | { |
1086 | 1255 | $val = $this->value['line-height']; |
1087 | - if ($val=='normal') $val = '108%'; |
|
1256 | + if ($val=='normal') { |
|
1257 | + $val = '108%'; |
|
1258 | + } |
|
1088 | 1259 | return $this->convertToMM($val, $this->value['font-size']); |
1089 | 1260 | } |
1090 | 1261 | |
@@ -1140,8 +1311,12 @@ discard block |
||
1140 | 1311 | */ |
1141 | 1312 | public function getFloat() |
1142 | 1313 | { |
1143 | - if ($this->value['float']=='left') return 'left'; |
|
1144 | - if ($this->value['float']=='right') return 'right'; |
|
1314 | + if ($this->value['float']=='left') { |
|
1315 | + return 'left'; |
|
1316 | + } |
|
1317 | + if ($this->value['float']=='right') { |
|
1318 | + return 'right'; |
|
1319 | + } |
|
1145 | 1320 | return null; |
1146 | 1321 | } |
1147 | 1322 | |
@@ -1171,7 +1346,9 @@ discard block |
||
1171 | 1346 | protected function _getLastAbsoluteX() |
1172 | 1347 | { |
1173 | 1348 | for ($k=count($this->table)-1; $k>=0; $k--) { |
1174 | - if ($this->table[$k]['x'] && $this->table[$k]['position']) return $this->table[$k]['x']; |
|
1349 | + if ($this->table[$k]['x'] && $this->table[$k]['position']) { |
|
1350 | + return $this->table[$k]['x']; |
|
1351 | + } |
|
1175 | 1352 | } |
1176 | 1353 | return $this->_pdf->getlMargin(); |
1177 | 1354 | } |
@@ -1185,7 +1362,9 @@ discard block |
||
1185 | 1362 | protected function _getLastAbsoluteY() |
1186 | 1363 | { |
1187 | 1364 | for ($k=count($this->table)-1; $k>=0; $k--) { |
1188 | - if ($this->table[$k]['y'] && $this->table[$k]['position']) return $this->table[$k]['y']; |
|
1365 | + if ($this->table[$k]['y'] && $this->table[$k]['position']) { |
|
1366 | + return $this->table[$k]['y']; |
|
1367 | + } |
|
1189 | 1368 | } |
1190 | 1369 | return $this->_pdf->gettMargin(); |
1191 | 1370 | } |
@@ -1222,7 +1401,9 @@ discard block |
||
1222 | 1401 | if (count($getit)) { |
1223 | 1402 | // get them, but in the definition order, because of priority |
1224 | 1403 | asort($getit); |
1225 | - foreach ($getit as $key => $val) $styles = array_merge($styles, $this->css[$key]); |
|
1404 | + foreach ($getit as $key => $val) { |
|
1405 | + $styles = array_merge($styles, $this->css[$key]); |
|
1406 | + } |
|
1226 | 1407 | } |
1227 | 1408 | |
1228 | 1409 | return $styles; |
@@ -1242,7 +1423,9 @@ discard block |
||
1242 | 1423 | // if next step |
1243 | 1424 | if ($next!==null) { |
1244 | 1425 | // we remove this step |
1245 | - if ($next) $key = trim(substr($key, 0, -strlen($next))); |
|
1426 | + if ($next) { |
|
1427 | + $key = trim(substr($key, 0, -strlen($next))); |
|
1428 | + } |
|
1246 | 1429 | array_shift($lst); |
1247 | 1430 | |
1248 | 1431 | // if no more step to identify => return false |
@@ -1294,8 +1477,11 @@ discard block |
||
1294 | 1477 | $css = explode(' ', $css); |
1295 | 1478 | foreach ($css as $k => $v) { |
1296 | 1479 | $v = trim($v); |
1297 | - if ($v) $css[$k] = $v; |
|
1298 | - else unset($css[$k]); |
|
1480 | + if ($v) { |
|
1481 | + $css[$k] = $v; |
|
1482 | + } else { |
|
1483 | + unset($css[$k]); |
|
1484 | + } |
|
1299 | 1485 | } |
1300 | 1486 | $css = array_values($css); |
1301 | 1487 | |
@@ -1320,12 +1506,16 @@ discard block |
||
1320 | 1506 | // else, it could be the color |
1321 | 1507 | } else { |
1322 | 1508 | $tmp = $this->convertToColor($value, $res); |
1323 | - if ($res) $color = $tmp; |
|
1509 | + if ($res) { |
|
1510 | + $color = $tmp; |
|
1511 | + } |
|
1324 | 1512 | } |
1325 | 1513 | } |
1326 | 1514 | |
1327 | 1515 | // if no witdh => return none |
1328 | - if (!$width) return $none; |
|
1516 | + if (!$width) { |
|
1517 | + return $none; |
|
1518 | + } |
|
1329 | 1519 | |
1330 | 1520 | // return the border properties |
1331 | 1521 | return array('type' => $type, 'width' => $width, 'color' => $color); |
@@ -1414,7 +1604,9 @@ discard block |
||
1414 | 1604 | if ($pos) { |
1415 | 1605 | // try to read it |
1416 | 1606 | $pos = $this->convertBackgroundPosition($pos, $ok); |
1417 | - if ($ok) $value['position'] = $pos; |
|
1607 | + if ($ok) { |
|
1608 | + $value['position'] = $pos; |
|
1609 | + } |
|
1418 | 1610 | } |
1419 | 1611 | } |
1420 | 1612 | |
@@ -1428,8 +1620,11 @@ discard block |
||
1428 | 1620 | public function convertBackgroundColor($css) |
1429 | 1621 | { |
1430 | 1622 | $res = null; |
1431 | - if ($css=='transparent') return null; |
|
1432 | - else return $this->convertToColor($css, $res); |
|
1623 | + if ($css=='transparent') { |
|
1624 | + return null; |
|
1625 | + } else { |
|
1626 | + return $this->convertToColor($css, $res); |
|
1627 | + } |
|
1433 | 1628 | } |
1434 | 1629 | |
1435 | 1630 | /** |
@@ -1441,12 +1636,13 @@ discard block |
||
1441 | 1636 | */ |
1442 | 1637 | public function convertBackgroundImage($css) |
1443 | 1638 | { |
1444 | - if ($css=='none') |
|
1445 | - return null; |
|
1446 | - else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match)) |
|
1447 | - return $match[1]; |
|
1448 | - else |
|
1449 | - return null; |
|
1639 | + if ($css=='none') { |
|
1640 | + return null; |
|
1641 | + } else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match)) { |
|
1642 | + return $match[1]; |
|
1643 | + } else { |
|
1644 | + return null; |
|
1645 | + } |
|
1450 | 1646 | } |
1451 | 1647 | |
1452 | 1648 | /** |
@@ -1467,10 +1663,14 @@ discard block |
||
1467 | 1663 | |
1468 | 1664 | // we must have 2 values. if 0 or >2 : error. if 1 => put center for 2 |
1469 | 1665 | if (count($css)<2) { |
1470 | - if (!$css[0]) return null; |
|
1666 | + if (!$css[0]) { |
|
1667 | + return null; |
|
1668 | + } |
|
1471 | 1669 | $css[1] = 'center'; |
1472 | 1670 | } |
1473 | - if (count($css)>2) return null; |
|
1671 | + if (count($css)>2) { |
|
1672 | + return null; |
|
1673 | + } |
|
1474 | 1674 | |
1475 | 1675 | // prepare the values |
1476 | 1676 | $x = 0; |
@@ -1478,24 +1678,42 @@ discard block |
||
1478 | 1678 | $res = true; |
1479 | 1679 | |
1480 | 1680 | // convert the first value |
1481 | - if ($css[0]=='left') $x = '0%'; |
|
1482 | - else if ($css[0]=='center') $x = '50%'; |
|
1483 | - else if ($css[0]=='right') $x = '100%'; |
|
1484 | - else if ($css[0]=='top') $y = '0%'; |
|
1485 | - else if ($css[0]=='bottom') $y = '100%'; |
|
1486 | - else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) $x = $css[0]; |
|
1487 | - else if ($this->convertToMM($css[0])) $x = $this->convertToMM($css[0]); |
|
1488 | - else $res = false; |
|
1681 | + if ($css[0]=='left') { |
|
1682 | + $x = '0%'; |
|
1683 | + } else if ($css[0]=='center') { |
|
1684 | + $x = '50%'; |
|
1685 | + } else if ($css[0]=='right') { |
|
1686 | + $x = '100%'; |
|
1687 | + } else if ($css[0]=='top') { |
|
1688 | + $y = '0%'; |
|
1689 | + } else if ($css[0]=='bottom') { |
|
1690 | + $y = '100%'; |
|
1691 | + } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) { |
|
1692 | + $x = $css[0]; |
|
1693 | + } else if ($this->convertToMM($css[0])) { |
|
1694 | + $x = $this->convertToMM($css[0]); |
|
1695 | + } else { |
|
1696 | + $res = false; |
|
1697 | + } |
|
1489 | 1698 | |
1490 | 1699 | // convert the second value |
1491 | - if ($css[1]=='left') $x = '0%'; |
|
1492 | - else if ($css[1]=='right') $x = '100%'; |
|
1493 | - else if ($css[1]=='top') $y = '0%'; |
|
1494 | - else if ($css[1]=='center') $y = '50%'; |
|
1495 | - else if ($css[1]=='bottom') $y = '100%'; |
|
1496 | - else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) $y = $css[1]; |
|
1497 | - else if ($this->convertToMM($css[1])) $y = $this->convertToMM($css[1]); |
|
1498 | - else $res = false; |
|
1700 | + if ($css[1]=='left') { |
|
1701 | + $x = '0%'; |
|
1702 | + } else if ($css[1]=='right') { |
|
1703 | + $x = '100%'; |
|
1704 | + } else if ($css[1]=='top') { |
|
1705 | + $y = '0%'; |
|
1706 | + } else if ($css[1]=='center') { |
|
1707 | + $y = '50%'; |
|
1708 | + } else if ($css[1]=='bottom') { |
|
1709 | + $y = '100%'; |
|
1710 | + } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) { |
|
1711 | + $y = $css[1]; |
|
1712 | + } else if ($this->convertToMM($css[1])) { |
|
1713 | + $y = $this->convertToMM($css[1]); |
|
1714 | + } else { |
|
1715 | + $res = false; |
|
1716 | + } |
|
1499 | 1717 | |
1500 | 1718 | // return the values |
1501 | 1719 | return array($x, $y); |
@@ -1535,13 +1753,22 @@ discard block |
||
1535 | 1753 | public function convertToMM($css, $old=0.) |
1536 | 1754 | { |
1537 | 1755 | $css = trim($css); |
1538 | - if (preg_match('/^[0-9\.\-]+$/isU', $css)) $css.= 'px'; |
|
1539 | - if (preg_match('/^[0-9\.\-]+px$/isU', $css)) $css = 25.4/96. * str_replace('px', '', $css); |
|
1540 | - else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) $css = 25.4/72. * str_replace('pt', '', $css); |
|
1541 | - else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) $css = 25.4 * str_replace('in', '', $css); |
|
1542 | - else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) $css = 1.*str_replace('mm', '', $css); |
|
1543 | - else if (preg_match('/^[0-9\.\-]+%$/isU', $css)) $css = 1.*$old*str_replace('%', '', $css)/100.; |
|
1544 | - else $css = null; |
|
1756 | + if (preg_match('/^[0-9\.\-]+$/isU', $css)) { |
|
1757 | + $css.= 'px'; |
|
1758 | + } |
|
1759 | + if (preg_match('/^[0-9\.\-]+px$/isU', $css)) { |
|
1760 | + $css = 25.4/96. * str_replace('px', '', $css); |
|
1761 | + } else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) { |
|
1762 | + $css = 25.4/72. * str_replace('pt', '', $css); |
|
1763 | + } else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) { |
|
1764 | + $css = 25.4 * str_replace('in', '', $css); |
|
1765 | + } else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) { |
|
1766 | + $css = 1.*str_replace('mm', '', $css); |
|
1767 | + } else if (preg_match('/^[0-9\.\-]+%$/isU', $css)) { |
|
1768 | + $css = 1.*$old*str_replace('%', '', $css)/100.; |
|
1769 | + } else { |
|
1770 | + $css = null; |
|
1771 | + } |
|
1545 | 1772 | |
1546 | 1773 | return $css; |
1547 | 1774 | } |
@@ -1590,7 +1817,9 @@ discard block |
||
1590 | 1817 | $res = true; |
1591 | 1818 | |
1592 | 1819 | // if transparent => return null |
1593 | - if (strtolower($css)=='transparent') return array(null, null, null); |
|
1820 | + if (strtolower($css)=='transparent') { |
|
1821 | + return array(null, null, null); |
|
1822 | + } |
|
1594 | 1823 | |
1595 | 1824 | // HTML color |
1596 | 1825 | if (isset($this->_htmlColor[strtolower($css)])) { |
@@ -1651,7 +1880,9 @@ discard block |
||
1651 | 1880 | $c = floatVal(substr($c, 0, -1))/100.; |
1652 | 1881 | } else { |
1653 | 1882 | $c = floatVal($c); |
1654 | - if ($c>1) $c = $c/255.; |
|
1883 | + if ($c>1) { |
|
1884 | + $c = $c/255.; |
|
1885 | + } |
|
1655 | 1886 | } |
1656 | 1887 | |
1657 | 1888 | return $c; |
@@ -1705,13 +1936,16 @@ discard block |
||
1705 | 1936 | $name = trim($name); |
1706 | 1937 | |
1707 | 1938 | // if a selector with somethink lige :hover => continue |
1708 | - if (strpos($name, ':')!==false) continue; |
|
1939 | + if (strpos($name, ':')!==false) { |
|
1940 | + continue; |
|
1941 | + } |
|
1709 | 1942 | |
1710 | 1943 | // save the value |
1711 | - if (!isset($this->css[$name])) |
|
1712 | - $this->css[$name] = $css; |
|
1713 | - else |
|
1714 | - $this->css[$name] = array_merge($this->css[$name], $css); |
|
1944 | + if (!isset($this->css[$name])) { |
|
1945 | + $this->css[$name] = $css; |
|
1946 | + } else { |
|
1947 | + $this->css[$name] = array_merge($this->css[$name], $css); |
|
1948 | + } |
|
1715 | 1949 | |
1716 | 1950 | } |
1717 | 1951 | } |
@@ -162,7 +162,9 @@ discard block |
||
162 | 162 | $this->_subPart = false; |
163 | 163 | |
164 | 164 | // init the marges of the page |
165 | - if (!is_array($marges)) $marges = array($marges, $marges, $marges, $marges); |
|
165 | + if (!is_array($marges)) { |
|
166 | + $marges = array($marges, $marges, $marges, $marges); |
|
167 | + } |
|
166 | 168 | $this->_setDefaultMargins($marges[0], $marges[1], $marges[2], $marges[3]); |
167 | 169 | $this->_setMargins(); |
168 | 170 | $this->_marges = array(); |
@@ -310,7 +312,9 @@ discard block |
||
310 | 312 | { |
311 | 313 | $oldPage = $this->_INDEX_NewPage($onPage); |
312 | 314 | $this->pdf->createIndex($this, $titre, $sizeTitle, $sizeBookmark, $bookmarkTitle, $displayPage, $onPage, $fontName); |
313 | - if ($oldPage) $this->pdf->setPage($oldPage); |
|
315 | + if ($oldPage) { |
|
316 | + $this->pdf->setPage($oldPage); |
|
317 | + } |
|
314 | 318 | } |
315 | 319 | |
316 | 320 | /** |
@@ -356,14 +360,24 @@ discard block |
||
356 | 360 | } |
357 | 361 | |
358 | 362 | // complete parameters |
359 | - if ($dest===false) $dest = 'I'; |
|
360 | - if ($dest===true) $dest = 'S'; |
|
361 | - if ($dest==='') $dest = 'I'; |
|
362 | - if ($name=='') $name='document.pdf'; |
|
363 | + if ($dest===false) { |
|
364 | + $dest = 'I'; |
|
365 | + } |
|
366 | + if ($dest===true) { |
|
367 | + $dest = 'S'; |
|
368 | + } |
|
369 | + if ($dest==='') { |
|
370 | + $dest = 'I'; |
|
371 | + } |
|
372 | + if ($name=='') { |
|
373 | + $name='document.pdf'; |
|
374 | + } |
|
363 | 375 | |
364 | 376 | // clean up the destination |
365 | 377 | $dest = strtoupper($dest); |
366 | - if (!in_array($dest, array('I', 'D', 'F', 'S', 'FI','FD'))) $dest = 'I'; |
|
378 | + if (!in_array($dest, array('I', 'D', 'F', 'S', 'FI','FD'))) { |
|
379 | + $dest = 'I'; |
|
380 | + } |
|
367 | 381 | |
368 | 382 | // the name must be a PDF name |
369 | 383 | if (strtolower(substr($name, -4))!='.pdf') { |
@@ -385,8 +399,9 @@ discard block |
||
385 | 399 | public function writeHTML($html, $debugVue = false) |
386 | 400 | { |
387 | 401 | // if it is a real html page, we have to convert it |
388 | - if (preg_match('/<body/isU', $html)) |
|
389 | - $html = $this->getHtmlFromPage($html); |
|
402 | + if (preg_match('/<body/isU', $html)) { |
|
403 | + $html = $this->getHtmlFromPage($html); |
|
404 | + } |
|
390 | 405 | |
391 | 406 | $html = str_replace('[[date_y]]', date('Y'), $html); |
392 | 407 | $html = str_replace('[[date_m]]', date('m'), $html); |
@@ -422,20 +437,24 @@ discard block |
||
422 | 437 | |
423 | 438 | // extract the content |
424 | 439 | $res = explode('<body', $html); |
425 | - if (count($res)<2) return $html; |
|
440 | + if (count($res)<2) { |
|
441 | + return $html; |
|
442 | + } |
|
426 | 443 | $content = '<page'.$res[1]; |
427 | 444 | $content = explode('</body', $content); |
428 | 445 | $content = $content[0].'</page>'; |
429 | 446 | |
430 | 447 | // extract the link tags |
431 | 448 | preg_match_all('/<link([^>]*)>/isU', $html, $match); |
432 | - foreach ($match[0] as $src) |
|
433 | - $content = $src.'</link>'.$content; |
|
449 | + foreach ($match[0] as $src) { |
|
450 | + $content = $src.'</link>'.$content; |
|
451 | + } |
|
434 | 452 | |
435 | 453 | // extract the css style tags |
436 | 454 | preg_match_all('/<style[^>]*>(.*)<\/style[^>]*>/isU', $html, $match); |
437 | - foreach ($match[0] as $src) |
|
438 | - $content = $src.$content; |
|
455 | + foreach ($match[0] as $src) { |
|
456 | + $content = $src.$content; |
|
457 | + } |
|
439 | 458 | |
440 | 459 | return $content; |
441 | 460 | } |
@@ -513,8 +532,12 @@ discard block |
||
513 | 532 | */ |
514 | 533 | protected function _setDefaultMargins($left, $top, $right = null, $bottom = null) |
515 | 534 | { |
516 | - if ($right===null) $right = $left; |
|
517 | - if ($bottom===null) $bottom = 8; |
|
535 | + if ($right===null) { |
|
536 | + $right = $left; |
|
537 | + } |
|
538 | + if ($bottom===null) { |
|
539 | + $bottom = 8; |
|
540 | + } |
|
518 | 541 | |
519 | 542 | $this->_defaultLeft = $this->parsingCss->ConvertToMM($left.'mm'); |
520 | 543 | $this->_defaultTop = $this->parsingCss->ConvertToMM($top.'mm'); |
@@ -565,8 +588,9 @@ discard block |
||
565 | 588 | $this->pdf->Rect(0, 0, $this->pdf->getW(), $this->pdf->getH(), 'F'); |
566 | 589 | } |
567 | 590 | |
568 | - if (isset($this->_background['img']) && $this->_background['img']) |
|
569 | - $this->pdf->Image($this->_background['img'], $this->_background['posX'], $this->_background['posY'], $this->_background['width']); |
|
591 | + if (isset($this->_background['img']) && $this->_background['img']) { |
|
592 | + $this->pdf->Image($this->_background['img'], $this->_background['posX'], $this->_background['posY'], $this->_background['width']); |
|
593 | + } |
|
570 | 594 | } |
571 | 595 | |
572 | 596 | $this->_setPageHeader(); |
@@ -617,7 +641,9 @@ discard block |
||
617 | 641 | protected function _DEBUG_add($name, $level=null) |
618 | 642 | { |
619 | 643 | // if true : UP |
620 | - if ($level===true) $this->_debugLevel++; |
|
644 | + if ($level===true) { |
|
645 | + $this->_debugLevel++; |
|
646 | + } |
|
621 | 647 | |
622 | 648 | $name = str_repeat(' ', $this->_debugLevel). $name.($level===true ? ' Begin' : ($level===false ? ' End' : '')); |
623 | 649 | $time = microtime(true); |
@@ -635,7 +661,9 @@ discard block |
||
635 | 661 | $this->_debugLastTime = $time; |
636 | 662 | |
637 | 663 | // it false : DOWN |
638 | - if ($level===false) $this->_debugLevel--; |
|
664 | + if ($level===false) { |
|
665 | + $this->_debugLevel--; |
|
666 | + } |
|
639 | 667 | |
640 | 668 | return $this; |
641 | 669 | } |
@@ -674,8 +702,9 @@ discard block |
||
674 | 702 | $y = floor($y*100); |
675 | 703 | $x = array($this->pdf->getlMargin(), $this->pdf->getW()-$this->pdf->getrMargin()); |
676 | 704 | |
677 | - foreach ($this->_pageMarges as $mY => $mX) |
|
678 | - if ($mY<=$y) $x = $mX; |
|
705 | + foreach ($this->_pageMarges as $mY => $mX) { |
|
706 | + if ($mY<=$y) $x = $mX; |
|
707 | + } |
|
679 | 708 | |
680 | 709 | return $x; |
681 | 710 | } |
@@ -697,18 +726,30 @@ discard block |
||
697 | 726 | $oldBottom = $this->_getMargins($yBottom); |
698 | 727 | |
699 | 728 | // update the top float margin |
700 | - if ($float=='left' && $oldTop[0]<$xRight) $oldTop[0] = $xRight; |
|
701 | - if ($float=='right' && $oldTop[1]>$xLeft) $oldTop[1] = $xLeft; |
|
729 | + if ($float=='left' && $oldTop[0]<$xRight) { |
|
730 | + $oldTop[0] = $xRight; |
|
731 | + } |
|
732 | + if ($float=='right' && $oldTop[1]>$xLeft) { |
|
733 | + $oldTop[1] = $xLeft; |
|
734 | + } |
|
702 | 735 | |
703 | 736 | $yTop = floor($yTop*100); |
704 | 737 | $yBottom = floor($yBottom*100); |
705 | 738 | |
706 | 739 | // erase all the float margins that are smaller than the new one |
707 | 740 | foreach ($this->_pageMarges as $mY => $mX) { |
708 | - if ($mY<$yTop) continue; |
|
709 | - if ($mY>$yBottom) break; |
|
710 | - if ($float=='left' && $this->_pageMarges[$mY][0]<$xRight) unset($this->_pageMarges[$mY]); |
|
711 | - if ($float=='right' && $this->_pageMarges[$mY][1]>$xLeft) unset($this->_pageMarges[$mY]); |
|
741 | + if ($mY<$yTop) { |
|
742 | + continue; |
|
743 | + } |
|
744 | + if ($mY>$yBottom) { |
|
745 | + break; |
|
746 | + } |
|
747 | + if ($float=='left' && $this->_pageMarges[$mY][0]<$xRight) { |
|
748 | + unset($this->_pageMarges[$mY]); |
|
749 | + } |
|
750 | + if ($float=='right' && $this->_pageMarges[$mY][1]>$xLeft) { |
|
751 | + unset($this->_pageMarges[$mY]); |
|
752 | + } |
|
712 | 753 | } |
713 | 754 | |
714 | 755 | // save the new Top and Bottom margins |
@@ -806,7 +847,9 @@ discard block |
||
806 | 847 | */ |
807 | 848 | protected function _setPageHeader() |
808 | 849 | { |
809 | - if (!count($this->_subHEADER)) return false; |
|
850 | + if (!count($this->_subHEADER)) { |
|
851 | + return false; |
|
852 | + } |
|
810 | 853 | |
811 | 854 | $oldParsePos = $this->_parsePos; |
812 | 855 | $oldParseCode = $this->parsingHtml->code; |
@@ -826,7 +869,9 @@ discard block |
||
826 | 869 | */ |
827 | 870 | protected function _setPageFooter() |
828 | 871 | { |
829 | - if (!count($this->_subFOOTER)) return false; |
|
872 | + if (!count($this->_subFOOTER)) { |
|
873 | + return false; |
|
874 | + } |
|
830 | 875 | |
831 | 876 | $oldParsePos = $this->_parsePos; |
832 | 877 | $oldParseCode = $this->parsingHtml->code; |
@@ -887,15 +932,18 @@ discard block |
||
887 | 932 | $txt = $sub->parsingHtml->code[$this->_parsePos]['param']['txt']; |
888 | 933 | $txt = str_replace('[[page_cu]]', $sub->pdf->getMyNumPage($this->_page), $txt); |
889 | 934 | $sub->parsingHtml->code[$this->_parsePos]['param']['txt'] = substr($txt, $curr+1); |
890 | - } else |
|
891 | - $sub->_parsePos++; |
|
935 | + } else { |
|
936 | + $sub->_parsePos++; |
|
937 | + } |
|
892 | 938 | |
893 | 939 | // for each element of the parsing => load the action |
894 | 940 | $res = null; |
895 | 941 | for ($sub->_parsePos; $sub->_parsePos<count($sub->parsingHtml->code); $sub->_parsePos++) { |
896 | 942 | $action = $sub->parsingHtml->code[$sub->_parsePos]; |
897 | 943 | $res = $sub->_executeAction($action); |
898 | - if (!$res) break; |
|
944 | + if (!$res) { |
|
945 | + break; |
|
946 | + } |
|
899 | 947 | } |
900 | 948 | |
901 | 949 | $w = $sub->_maxX; // max width |
@@ -906,12 +954,13 @@ discard block |
||
906 | 954 | $this->_destroySubHTML($sub); |
907 | 955 | |
908 | 956 | // adapt the start of the line, depending on the text-align |
909 | - if ($this->parsingCss->value['text-align']=='center') |
|
910 | - $this->pdf->setX(($rx+$this->pdf->getX()-$w)*0.5-0.01); |
|
911 | - else if ($this->parsingCss->value['text-align']=='right') |
|
912 | - $this->pdf->setX($rx-$w-0.01); |
|
913 | - else |
|
914 | - $this->pdf->setX($lx); |
|
957 | + if ($this->parsingCss->value['text-align']=='center') { |
|
958 | + $this->pdf->setX(($rx+$this->pdf->getX()-$w)*0.5-0.01); |
|
959 | + } else if ($this->parsingCss->value['text-align']=='right') { |
|
960 | + $this->pdf->setX($rx-$w-0.01); |
|
961 | + } else { |
|
962 | + $this->pdf->setX($lx); |
|
963 | + } |
|
915 | 964 | |
916 | 965 | // set the height of the line |
917 | 966 | $this->_currentH = $h; |
@@ -1024,8 +1073,12 @@ discard block |
||
1024 | 1073 | $nbBaseFive = array('V','L','D'); |
1025 | 1074 | $nbRoman = ''; |
1026 | 1075 | |
1027 | - if ($nbArabic<1) return $nbArabic; |
|
1028 | - if ($nbArabic>3999) return $nbArabic; |
|
1076 | + if ($nbArabic<1) { |
|
1077 | + return $nbArabic; |
|
1078 | + } |
|
1079 | + if ($nbArabic>3999) { |
|
1080 | + return $nbArabic; |
|
1081 | + } |
|
1029 | 1082 | |
1030 | 1083 | for ($i=3; $i>=0 ; $i--) { |
1031 | 1084 | $chiffre=floor($nbArabic/pow(10, $i)); |
@@ -1095,7 +1148,9 @@ discard block |
||
1095 | 1148 | $nb = $this->_defList[count($this->_defList)-1]['nb']; |
1096 | 1149 | $up = (substr($st, 0, 6)=='upper-'); |
1097 | 1150 | |
1098 | - if ($im) return array(false, false, $im); |
|
1151 | + if ($im) { |
|
1152 | + return array(false, false, $im); |
|
1153 | + } |
|
1099 | 1154 | |
1100 | 1155 | switch($st) |
1101 | 1156 | { |
@@ -1156,12 +1211,19 @@ discard block |
||
1156 | 1211 | } |
1157 | 1212 | |
1158 | 1213 | // prepare the datas |
1159 | - if (!in_array($type, array('ul', 'ol'))) $type = 'ul'; |
|
1160 | - if (!in_array($style, array('lower-alpha', 'upper-alpha', 'upper-roman', 'lower-roman', 'decimal', 'square', 'circle', 'disc', 'none'))) $style = ''; |
|
1214 | + if (!in_array($type, array('ul', 'ol'))) { |
|
1215 | + $type = 'ul'; |
|
1216 | + } |
|
1217 | + if (!in_array($style, array('lower-alpha', 'upper-alpha', 'upper-roman', 'lower-roman', 'decimal', 'square', 'circle', 'disc', 'none'))) { |
|
1218 | + $style = ''; |
|
1219 | + } |
|
1161 | 1220 | |
1162 | 1221 | if (!$style) { |
1163 | - if ($type=='ul') $style = 'disc'; |
|
1164 | - else $style = 'decimal'; |
|
1222 | + if ($type=='ul') { |
|
1223 | + $style = 'disc'; |
|
1224 | + } else { |
|
1225 | + $style = 'decimal'; |
|
1226 | + } |
|
1165 | 1227 | } |
1166 | 1228 | |
1167 | 1229 | // add the new level |
@@ -1270,8 +1332,9 @@ discard block |
||
1270 | 1332 | */ |
1271 | 1333 | protected function _getElementY($h) |
1272 | 1334 | { |
1273 | - if ($this->_subPart || $this->_isSubPart || !$this->_currentH || $this->_currentH<$h) |
|
1274 | - return 0; |
|
1335 | + if ($this->_subPart || $this->_isSubPart || !$this->_currentH || $this->_currentH<$h) { |
|
1336 | + return 0; |
|
1337 | + } |
|
1275 | 1338 | |
1276 | 1339 | return ($this->_currentH-$h)*0.8; |
1277 | 1340 | } |
@@ -1286,10 +1349,11 @@ discard block |
||
1286 | 1349 | protected function _makeBreakLine($h, $curr = null) |
1287 | 1350 | { |
1288 | 1351 | if ($h) { |
1289 | - if (($this->pdf->getY()+$h<$this->pdf->getH() - $this->pdf->getbMargin()) || $this->_isInOverflow || $this->_isInFooter) |
|
1290 | - $this->_setNewLine($h, $curr); |
|
1291 | - else |
|
1292 | - $this->_setNewPage(null, '', null, $curr); |
|
1352 | + if (($this->pdf->getY()+$h<$this->pdf->getH() - $this->pdf->getbMargin()) || $this->_isInOverflow || $this->_isInFooter) { |
|
1353 | + $this->_setNewLine($h, $curr); |
|
1354 | + } else { |
|
1355 | + $this->_setNewPage(null, '', null, $curr); |
|
1356 | + } |
|
1293 | 1357 | } else { |
1294 | 1358 | $this->_setNewPositionForNewLine($curr); |
1295 | 1359 | } |
@@ -1413,7 +1477,9 @@ discard block |
||
1413 | 1477 | |
1414 | 1478 | // calculate the position of the image, if align to the right |
1415 | 1479 | if ($parentWidth>$w && $float!='left') { |
1416 | - if ($float=='right' || $this->parsingCss->value['text-align']=='li_right') $x = $parentX + $parentWidth - $w-$this->parsingCss->value['margin']['r']-$this->parsingCss->value['margin']['l']; |
|
1480 | + if ($float=='right' || $this->parsingCss->value['text-align']=='li_right') { |
|
1481 | + $x = $parentX + $parentWidth - $w-$this->parsingCss->value['margin']['r']-$this->parsingCss->value['margin']['l']; |
|
1482 | + } |
|
1417 | 1483 | } |
1418 | 1484 | |
1419 | 1485 | // display the image |
@@ -1484,7 +1550,9 @@ discard block |
||
1484 | 1550 | protected function _drawRectangle($x, $y, $w, $h, $border, $padding, $margin, $background) |
1485 | 1551 | { |
1486 | 1552 | // if we are in a subpart or if height is null => return false |
1487 | - if ($this->_subPart || $this->_isSubPart || $h===null) return false; |
|
1553 | + if ($this->_subPart || $this->_isSubPart || $h===null) { |
|
1554 | + return false; |
|
1555 | + } |
|
1488 | 1556 | |
1489 | 1557 | // add the margin |
1490 | 1558 | $x+= $margin; |
@@ -1527,10 +1595,18 @@ discard block |
||
1527 | 1595 | $inBL[1]-= $border['b']['width']; |
1528 | 1596 | } |
1529 | 1597 | |
1530 | - if ($inTL[0]<=0 || $inTL[1]<=0) $inTL = null; |
|
1531 | - if ($inTR[0]<=0 || $inTR[1]<=0) $inTR = null; |
|
1532 | - if ($inBR[0]<=0 || $inBR[1]<=0) $inBR = null; |
|
1533 | - if ($inBL[0]<=0 || $inBL[1]<=0) $inBL = null; |
|
1598 | + if ($inTL[0]<=0 || $inTL[1]<=0) { |
|
1599 | + $inTL = null; |
|
1600 | + } |
|
1601 | + if ($inTR[0]<=0 || $inTR[1]<=0) { |
|
1602 | + $inTR = null; |
|
1603 | + } |
|
1604 | + if ($inBR[0]<=0 || $inBR[1]<=0) { |
|
1605 | + $inBR = null; |
|
1606 | + } |
|
1607 | + if ($inBL[0]<=0 || $inBL[1]<=0) { |
|
1608 | + $inBL = null; |
|
1609 | + } |
|
1534 | 1610 | |
1535 | 1611 | // prepare the background color |
1536 | 1612 | $pdfStyle = ''; |
@@ -1588,13 +1664,21 @@ discard block |
||
1588 | 1664 | $imageHeight = 72./96.*$imageInfos[1]/$this->pdf->getK(); |
1589 | 1665 | |
1590 | 1666 | // prepare the position of the backgroung |
1591 | - if ($iRepeat[0]) $iPosition[0] = $bX; |
|
1592 | - else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[0], $match)) $iPosition[0] = $bX + $match[1]*($bW-$imageWidth)/100; |
|
1593 | - else $iPosition[0] = $bX+$iPosition[0]; |
|
1667 | + if ($iRepeat[0]) { |
|
1668 | + $iPosition[0] = $bX; |
|
1669 | + } else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[0], $match)) { |
|
1670 | + $iPosition[0] = $bX + $match[1]*($bW-$imageWidth)/100; |
|
1671 | + } else { |
|
1672 | + $iPosition[0] = $bX+$iPosition[0]; |
|
1673 | + } |
|
1594 | 1674 | |
1595 | - if ($iRepeat[1]) $iPosition[1] = $bY; |
|
1596 | - else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[1], $match)) $iPosition[1] = $bY + $match[1]*($bH-$imageHeight)/100; |
|
1597 | - else $iPosition[1] = $bY+$iPosition[1]; |
|
1675 | + if ($iRepeat[1]) { |
|
1676 | + $iPosition[1] = $bY; |
|
1677 | + } else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[1], $match)) { |
|
1678 | + $iPosition[1] = $bY + $match[1]*($bH-$imageHeight)/100; |
|
1679 | + } else { |
|
1680 | + $iPosition[1] = $bY+$iPosition[1]; |
|
1681 | + } |
|
1598 | 1682 | |
1599 | 1683 | $imageXmin = $bX; |
1600 | 1684 | $imageXmax = $bX+$bW; |
@@ -1646,10 +1730,18 @@ discard block |
||
1646 | 1730 | $y-= $loose; |
1647 | 1731 | $w+= 2.*$loose; |
1648 | 1732 | $h+= 2.*$loose; |
1649 | - if ($border['l']['width']) $border['l']['width']+= 2.*$loose; |
|
1650 | - if ($border['t']['width']) $border['t']['width']+= 2.*$loose; |
|
1651 | - if ($border['r']['width']) $border['r']['width']+= 2.*$loose; |
|
1652 | - if ($border['b']['width']) $border['b']['width']+= 2.*$loose; |
|
1733 | + if ($border['l']['width']) { |
|
1734 | + $border['l']['width']+= 2.*$loose; |
|
1735 | + } |
|
1736 | + if ($border['t']['width']) { |
|
1737 | + $border['t']['width']+= 2.*$loose; |
|
1738 | + } |
|
1739 | + if ($border['r']['width']) { |
|
1740 | + $border['r']['width']+= 2.*$loose; |
|
1741 | + } |
|
1742 | + if ($border['b']['width']) { |
|
1743 | + $border['b']['width']+= 2.*$loose; |
|
1744 | + } |
|
1653 | 1745 | |
1654 | 1746 | // prepare the test on borders |
1655 | 1747 | $testBl = ($border['l']['width'] && $border['l']['color'][0]!==null); |
@@ -1747,13 +1839,17 @@ discard block |
||
1747 | 1839 | if (is_array($outBL)) { |
1748 | 1840 | $bord-=1; |
1749 | 1841 | $pt[3] -= $outBL[1] - $border['b']['width']; |
1750 | - if ($inBL) $pt[11]-= $inBL[1]; |
|
1842 | + if ($inBL) { |
|
1843 | + $pt[11]-= $inBL[1]; |
|
1844 | + } |
|
1751 | 1845 | unset($pt[0]);unset($pt[1]); |
1752 | 1846 | } |
1753 | 1847 | if (is_array($outTL)) { |
1754 | 1848 | $bord-=2; |
1755 | 1849 | $pt[5] += $outTL[1]-$border['t']['width']; |
1756 | - if ($inTL) $pt[9] += $inTL[1]; |
|
1850 | + if ($inTL) { |
|
1851 | + $pt[9] += $inTL[1]; |
|
1852 | + } |
|
1757 | 1853 | unset($pt[6]);unset($pt[7]); |
1758 | 1854 | } |
1759 | 1855 | |
@@ -1775,13 +1871,17 @@ discard block |
||
1775 | 1871 | if (is_array($outTL)) { |
1776 | 1872 | $bord-=1; |
1777 | 1873 | $pt[2] += $outTL[0] - $border['l']['width']; |
1778 | - if ($inTL) $pt[10]+= $inTL[0]; |
|
1874 | + if ($inTL) { |
|
1875 | + $pt[10]+= $inTL[0]; |
|
1876 | + } |
|
1779 | 1877 | unset($pt[0]);unset($pt[1]); |
1780 | 1878 | } |
1781 | 1879 | if (is_array($outTR)) { |
1782 | 1880 | $bord-=2; |
1783 | 1881 | $pt[4] -= $outTR[0] - $border['r']['width']; |
1784 | - if ($inTR) $pt[8] -= $inTR[0]; |
|
1882 | + if ($inTR) { |
|
1883 | + $pt[8] -= $inTR[0]; |
|
1884 | + } |
|
1785 | 1885 | unset($pt[6]);unset($pt[7]); |
1786 | 1886 | } |
1787 | 1887 | |
@@ -1803,13 +1903,17 @@ discard block |
||
1803 | 1903 | if (is_array($outTR)) { |
1804 | 1904 | $bord-=1; |
1805 | 1905 | $pt[3] += $outTR[1] - $border['t']['width']; |
1806 | - if ($inTR) $pt[11]+= $inTR[1]; |
|
1906 | + if ($inTR) { |
|
1907 | + $pt[11]+= $inTR[1]; |
|
1908 | + } |
|
1807 | 1909 | unset($pt[0]);unset($pt[1]); |
1808 | 1910 | } |
1809 | 1911 | if (is_array($outBR)) { |
1810 | 1912 | $bord-=2; |
1811 | 1913 | $pt[5] -= $outBR[1] - $border['b']['width']; |
1812 | - if ($inBR) $pt[9] -= $inBR[1]; |
|
1914 | + if ($inBR) { |
|
1915 | + $pt[9] -= $inBR[1]; |
|
1916 | + } |
|
1813 | 1917 | unset($pt[6]);unset($pt[7]); |
1814 | 1918 | } |
1815 | 1919 | |
@@ -1831,13 +1935,17 @@ discard block |
||
1831 | 1935 | if (is_array($outBL)) { |
1832 | 1936 | $bord-=2; |
1833 | 1937 | $pt[4] += $outBL[0] - $border['l']['width']; |
1834 | - if ($inBL) $pt[8] += $inBL[0]; |
|
1938 | + if ($inBL) { |
|
1939 | + $pt[8] += $inBL[0]; |
|
1940 | + } |
|
1835 | 1941 | unset($pt[6]);unset($pt[7]); |
1836 | 1942 | } |
1837 | 1943 | if (is_array($outBR)) { |
1838 | 1944 | $bord-=1; |
1839 | 1945 | $pt[2] -= $outBR[0] - $border['r']['width']; |
1840 | - if ($inBR) $pt[10]-= $inBR[0]; |
|
1946 | + if ($inBR) { |
|
1947 | + $pt[10]-= $inBR[0]; |
|
1948 | + } |
|
1841 | 1949 | unset($pt[0]);unset($pt[1]); |
1842 | 1950 | |
1843 | 1951 | } |
@@ -1864,10 +1972,11 @@ discard block |
||
1864 | 1972 | { |
1865 | 1973 | $this->pdf->setFillColorArray($color); |
1866 | 1974 | |
1867 | - if (count($pt)==10) |
|
1868 | - $this->pdf->drawCurve($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]); |
|
1869 | - else |
|
1870 | - $this->pdf->drawCorner($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7]); |
|
1975 | + if (count($pt)==10) { |
|
1976 | + $this->pdf->drawCurve($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]); |
|
1977 | + } else { |
|
1978 | + $this->pdf->drawCorner($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7]); |
|
1979 | + } |
|
1871 | 1980 | } |
1872 | 1981 | |
1873 | 1982 | /** |
@@ -1938,10 +2047,18 @@ discard block |
||
1938 | 2047 | for ($i=0; $l-($px+$py)*($i-0.5)>0; $i++) { |
1939 | 2048 | if (($i%2)==$mode) { |
1940 | 2049 | $j = $i-0.5; |
1941 | - $lx1 = $px*($j); if ($lx1<-$l) $lx1 =-$l; |
|
1942 | - $ly1 = $py*($j); if ($ly1<-$l) $ly1 =-$l; |
|
1943 | - $lx2 = $px*($j+1); if ($lx2>$l) $lx2 = $l; |
|
1944 | - $ly2 = $py*($j+1); if ($ly2>$l) $ly2 = $l; |
|
2050 | + $lx1 = $px*($j); if ($lx1<-$l) { |
|
2051 | + $lx1 =-$l; |
|
2052 | + } |
|
2053 | + $ly1 = $py*($j); if ($ly1<-$l) { |
|
2054 | + $ly1 =-$l; |
|
2055 | + } |
|
2056 | + $lx2 = $px*($j+1); if ($lx2>$l) { |
|
2057 | + $lx2 = $l; |
|
2058 | + } |
|
2059 | + $ly2 = $py*($j+1); if ($ly2>$l) { |
|
2060 | + $ly2 = $l; |
|
2061 | + } |
|
1945 | 2062 | |
1946 | 2063 | $tmp = array(); |
1947 | 2064 | $tmp[] = $x1+$lx1; $tmp[] = $y1+$ly1; |
@@ -2017,10 +2134,14 @@ discard block |
||
2017 | 2134 | protected function _prepareTransform($transform) |
2018 | 2135 | { |
2019 | 2136 | // it can not be empty |
2020 | - if (!$transform) return null; |
|
2137 | + if (!$transform) { |
|
2138 | + return null; |
|
2139 | + } |
|
2021 | 2140 | |
2022 | 2141 | // sctions must be like scale(...) |
2023 | - if (!preg_match_all('/([a-z]+)\(([^\)]*)\)/isU', $transform, $match)) return null; |
|
2142 | + if (!preg_match_all('/([a-z]+)\(([^\)]*)\)/isU', $transform, $match)) { |
|
2143 | + return null; |
|
2144 | + } |
|
2024 | 2145 | |
2025 | 2146 | // prepare the list of the actions |
2026 | 2147 | $actions = array(); |
@@ -2041,49 +2162,115 @@ discard block |
||
2041 | 2162 | switch($name) |
2042 | 2163 | { |
2043 | 2164 | case 'scale': |
2044 | - if (!isset($val[0])) $val[0] = 1.; else $val[0] = 1.*$val[0]; |
|
2045 | - if (!isset($val[1])) $val[1] = $val[0]; else $val[1] = 1.*$val[1]; |
|
2165 | + if (!isset($val[0])) { |
|
2166 | + $val[0] = 1.; |
|
2167 | + } else { |
|
2168 | + $val[0] = 1.*$val[0]; |
|
2169 | + } |
|
2170 | + if (!isset($val[1])) { |
|
2171 | + $val[1] = $val[0]; |
|
2172 | + } else { |
|
2173 | + $val[1] = 1.*$val[1]; |
|
2174 | + } |
|
2046 | 2175 | $actions[] = array($val[0],0,0,$val[1],0,0); |
2047 | 2176 | break; |
2048 | 2177 | |
2049 | 2178 | case 'translate': |
2050 | - if (!isset($val[0])) $val[0] = 0.; else $val[0] = $this->parsingCss->ConvertToMM($val[0], $this->_isInDraw['w']); |
|
2051 | - if (!isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['h']); |
|
2179 | + if (!isset($val[0])) { |
|
2180 | + $val[0] = 0.; |
|
2181 | + } else { |
|
2182 | + $val[0] = $this->parsingCss->ConvertToMM($val[0], $this->_isInDraw['w']); |
|
2183 | + } |
|
2184 | + if (!isset($val[1])) { |
|
2185 | + $val[1] = 0.; |
|
2186 | + } else { |
|
2187 | + $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['h']); |
|
2188 | + } |
|
2052 | 2189 | $actions[] = array(1,0,0,1,$val[0],$val[1]); |
2053 | 2190 | break; |
2054 | 2191 | |
2055 | 2192 | case 'rotate': |
2056 | - if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*M_PI/180.; |
|
2057 | - if (!isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['w']); |
|
2058 | - if (!isset($val[2])) $val[2] = 0.; else $val[2] = $this->parsingCss->ConvertToMM($val[2], $this->_isInDraw['h']); |
|
2059 | - if ($val[1] || $val[2]) $actions[] = array(1,0,0,1,-$val[1],-$val[2]); |
|
2193 | + if (!isset($val[0])) { |
|
2194 | + $val[0] = 0.; |
|
2195 | + } else { |
|
2196 | + $val[0] = $val[0]*M_PI/180.; |
|
2197 | + } |
|
2198 | + if (!isset($val[1])) { |
|
2199 | + $val[1] = 0.; |
|
2200 | + } else { |
|
2201 | + $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['w']); |
|
2202 | + } |
|
2203 | + if (!isset($val[2])) { |
|
2204 | + $val[2] = 0.; |
|
2205 | + } else { |
|
2206 | + $val[2] = $this->parsingCss->ConvertToMM($val[2], $this->_isInDraw['h']); |
|
2207 | + } |
|
2208 | + if ($val[1] || $val[2]) { |
|
2209 | + $actions[] = array(1,0,0,1,-$val[1],-$val[2]); |
|
2210 | + } |
|
2060 | 2211 | $actions[] = array(cos($val[0]),sin($val[0]),-sin($val[0]),cos($val[0]),0,0); |
2061 | - if ($val[1] || $val[2]) $actions[] = array(1,0,0,1,$val[1],$val[2]); |
|
2212 | + if ($val[1] || $val[2]) { |
|
2213 | + $actions[] = array(1,0,0,1,$val[1],$val[2]); |
|
2214 | + } |
|
2062 | 2215 | break; |
2063 | 2216 | |
2064 | 2217 | case 'skewx': |
2065 | - if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*M_PI/180.; |
|
2218 | + if (!isset($val[0])) { |
|
2219 | + $val[0] = 0.; |
|
2220 | + } else { |
|
2221 | + $val[0] = $val[0]*M_PI/180.; |
|
2222 | + } |
|
2066 | 2223 | $actions[] = array(1,0,tan($val[0]),1,0,0); |
2067 | 2224 | break; |
2068 | 2225 | |
2069 | 2226 | case 'skewy': |
2070 | - if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*M_PI/180.; |
|
2227 | + if (!isset($val[0])) { |
|
2228 | + $val[0] = 0.; |
|
2229 | + } else { |
|
2230 | + $val[0] = $val[0]*M_PI/180.; |
|
2231 | + } |
|
2071 | 2232 | $actions[] = array(1,tan($val[0]),0,1,0,0); |
2072 | 2233 | break; |
2073 | 2234 | case 'matrix': |
2074 | - if (!isset($val[0])) $val[0] = 0.; else $val[0] = $val[0]*1.; |
|
2075 | - if (!isset($val[1])) $val[1] = 0.; else $val[1] = $val[1]*1.; |
|
2076 | - if (!isset($val[2])) $val[2] = 0.; else $val[2] = $val[2]*1.; |
|
2077 | - if (!isset($val[3])) $val[3] = 0.; else $val[3] = $val[3]*1.; |
|
2078 | - if (!isset($val[4])) $val[4] = 0.; else $val[4] = $this->parsingCss->ConvertToMM($val[4], $this->_isInDraw['w']); |
|
2079 | - if (!isset($val[5])) $val[5] = 0.; else $val[5] = $this->parsingCss->ConvertToMM($val[5], $this->_isInDraw['h']); |
|
2235 | + if (!isset($val[0])) { |
|
2236 | + $val[0] = 0.; |
|
2237 | + } else { |
|
2238 | + $val[0] = $val[0]*1.; |
|
2239 | + } |
|
2240 | + if (!isset($val[1])) { |
|
2241 | + $val[1] = 0.; |
|
2242 | + } else { |
|
2243 | + $val[1] = $val[1]*1.; |
|
2244 | + } |
|
2245 | + if (!isset($val[2])) { |
|
2246 | + $val[2] = 0.; |
|
2247 | + } else { |
|
2248 | + $val[2] = $val[2]*1.; |
|
2249 | + } |
|
2250 | + if (!isset($val[3])) { |
|
2251 | + $val[3] = 0.; |
|
2252 | + } else { |
|
2253 | + $val[3] = $val[3]*1.; |
|
2254 | + } |
|
2255 | + if (!isset($val[4])) { |
|
2256 | + $val[4] = 0.; |
|
2257 | + } else { |
|
2258 | + $val[4] = $this->parsingCss->ConvertToMM($val[4], $this->_isInDraw['w']); |
|
2259 | + } |
|
2260 | + if (!isset($val[5])) { |
|
2261 | + $val[5] = 0.; |
|
2262 | + } else { |
|
2263 | + $val[5] = $this->parsingCss->ConvertToMM($val[5], $this->_isInDraw['h']); |
|
2264 | + } |
|
2080 | 2265 | $actions[] =$val; |
2081 | 2266 | break; |
2082 | 2267 | } |
2083 | 2268 | } |
2084 | 2269 | |
2085 | 2270 | // if ther is no actions => return |
2086 | - if (!$actions) return null; |
|
2271 | + if (!$actions) { |
|
2272 | + return null; |
|
2273 | + } |
|
2087 | 2274 | |
2088 | 2275 | // get the first matrix |
2089 | 2276 | $m = $actions[0]; unset($actions[0]); |
@@ -2111,7 +2298,9 @@ discard block |
||
2111 | 2298 | */ |
2112 | 2299 | protected function _calculateTableCellSize(&$cases, &$corr) |
2113 | 2300 | { |
2114 | - if (!isset($corr[0])) return true; |
|
2301 | + if (!isset($corr[0])) { |
|
2302 | + return true; |
|
2303 | + } |
|
2115 | 2304 | |
2116 | 2305 | // for each cell without colspan, we get the max width for each column |
2117 | 2306 | $sw = array(); |
@@ -2131,7 +2320,9 @@ discard block |
||
2131 | 2320 | if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2]>1) { |
2132 | 2321 | |
2133 | 2322 | // sum the max width of each column in colspan |
2134 | - $s = 0; for ($i=0; $i<$corr[$y][$x][2]; $i++) $s+= $sw[$x+$i]; |
|
2323 | + $s = 0; for ($i=0; $i<$corr[$y][$x][2]; $i++) { |
|
2324 | + $s+= $sw[$x+$i]; |
|
2325 | + } |
|
2135 | 2326 | |
2136 | 2327 | // if the max width is < the width of the cell with colspan => we adapt the width of each max width |
2137 | 2328 | if ($s>0 && $s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']) { |
@@ -2180,7 +2371,9 @@ discard block |
||
2180 | 2371 | if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3]>1) { |
2181 | 2372 | |
2182 | 2373 | // sum the max height of each line in rowspan |
2183 | - $s = 0; for ($i=0; $i<$corr[$y][$x][3]; $i++) $s+= $sh[$y+$i]; |
|
2374 | + $s = 0; for ($i=0; $i<$corr[$y][$x][3]; $i++) { |
|
2375 | + $s+= $sh[$y+$i]; |
|
2376 | + } |
|
2184 | 2377 | |
2185 | 2378 | // if the max height is < the height of the cell with rowspan => we adapt the height of each max height |
2186 | 2379 | if ($s>0 && $s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']) { |
@@ -2230,8 +2423,12 @@ discard block |
||
2230 | 2423 | */ |
2231 | 2424 | protected function _tag_open_PAGE($param) |
2232 | 2425 | { |
2233 | - if ($this->_isForOneLine) return false; |
|
2234 | - if ($this->_debugActif) $this->_DEBUG_add('PAGE '.($this->_page+1), true); |
|
2426 | + if ($this->_isForOneLine) { |
|
2427 | + return false; |
|
2428 | + } |
|
2429 | + if ($this->_debugActif) { |
|
2430 | + $this->_DEBUG_add('PAGE '.($this->_page+1), true); |
|
2431 | + } |
|
2235 | 2432 | |
2236 | 2433 | $newPageSet= (!isset($param['pageset']) || $param['pageset']!='old'); |
2237 | 2434 | |
@@ -2248,12 +2445,22 @@ discard block |
||
2248 | 2445 | $orientation = ''; |
2249 | 2446 | if (isset($param['orientation'])) { |
2250 | 2447 | $param['orientation'] = strtolower($param['orientation']); |
2251 | - if ($param['orientation']=='p') $orientation = 'P'; |
|
2252 | - if ($param['orientation']=='portrait') $orientation = 'P'; |
|
2448 | + if ($param['orientation']=='p') { |
|
2449 | + $orientation = 'P'; |
|
2450 | + } |
|
2451 | + if ($param['orientation']=='portrait') { |
|
2452 | + $orientation = 'P'; |
|
2453 | + } |
|
2253 | 2454 | |
2254 | - if ($param['orientation']=='l') $orientation = 'L'; |
|
2255 | - if ($param['orientation']=='paysage') $orientation = 'L'; |
|
2256 | - if ($param['orientation']=='landscape') $orientation = 'L'; |
|
2455 | + if ($param['orientation']=='l') { |
|
2456 | + $orientation = 'L'; |
|
2457 | + } |
|
2458 | + if ($param['orientation']=='paysage') { |
|
2459 | + $orientation = 'L'; |
|
2460 | + } |
|
2461 | + if ($param['orientation']=='landscape') { |
|
2462 | + $orientation = 'L'; |
|
2463 | + } |
|
2257 | 2464 | } |
2258 | 2465 | |
2259 | 2466 | // format |
@@ -2277,12 +2484,24 @@ discard block |
||
2277 | 2484 | $background['img'] = str_replace('&', '&', $background['img']); |
2278 | 2485 | |
2279 | 2486 | // convert the positions |
2280 | - if ($background['posX']=='left') $background['posX'] = '0%'; |
|
2281 | - if ($background['posX']=='center') $background['posX'] = '50%'; |
|
2282 | - if ($background['posX']=='right') $background['posX'] = '100%'; |
|
2283 | - if ($background['posY']=='top') $background['posY'] = '0%'; |
|
2284 | - if ($background['posY']=='middle') $background['posY'] = '50%'; |
|
2285 | - if ($background['posY']=='bottom') $background['posY'] = '100%'; |
|
2487 | + if ($background['posX']=='left') { |
|
2488 | + $background['posX'] = '0%'; |
|
2489 | + } |
|
2490 | + if ($background['posX']=='center') { |
|
2491 | + $background['posX'] = '50%'; |
|
2492 | + } |
|
2493 | + if ($background['posX']=='right') { |
|
2494 | + $background['posX'] = '100%'; |
|
2495 | + } |
|
2496 | + if ($background['posY']=='top') { |
|
2497 | + $background['posY'] = '0%'; |
|
2498 | + } |
|
2499 | + if ($background['posY']=='middle') { |
|
2500 | + $background['posY'] = '50%'; |
|
2501 | + } |
|
2502 | + if ($background['posY']=='bottom') { |
|
2503 | + $background['posY'] = '100%'; |
|
2504 | + } |
|
2286 | 2505 | |
2287 | 2506 | if ($background['img']) { |
2288 | 2507 | // get the size of the image |
@@ -2310,10 +2529,18 @@ discard block |
||
2310 | 2529 | $background['right'] = isset($param['backright']) ? $param['backright'] : '0'; |
2311 | 2530 | |
2312 | 2531 | // if no unit => mm |
2313 | - if (preg_match('/^([0-9]*)$/isU', $background['top'])) $background['top'] .= 'mm'; |
|
2314 | - if (preg_match('/^([0-9]*)$/isU', $background['bottom'])) $background['bottom'] .= 'mm'; |
|
2315 | - if (preg_match('/^([0-9]*)$/isU', $background['left'])) $background['left'] .= 'mm'; |
|
2316 | - if (preg_match('/^([0-9]*)$/isU', $background['right'])) $background['right'] .= 'mm'; |
|
2532 | + if (preg_match('/^([0-9]*)$/isU', $background['top'])) { |
|
2533 | + $background['top'] .= 'mm'; |
|
2534 | + } |
|
2535 | + if (preg_match('/^([0-9]*)$/isU', $background['bottom'])) { |
|
2536 | + $background['bottom'] .= 'mm'; |
|
2537 | + } |
|
2538 | + if (preg_match('/^([0-9]*)$/isU', $background['left'])) { |
|
2539 | + $background['left'] .= 'mm'; |
|
2540 | + } |
|
2541 | + if (preg_match('/^([0-9]*)$/isU', $background['right'])) { |
|
2542 | + $background['right'] .= 'mm'; |
|
2543 | + } |
|
2317 | 2544 | |
2318 | 2545 | // convert to mm |
2319 | 2546 | $background['top'] = $this->parsingCss->ConvertToMM($background['top'], $this->pdf->getH()); |
@@ -2324,7 +2551,9 @@ discard block |
||
2324 | 2551 | // get the background color |
2325 | 2552 | $res = false; |
2326 | 2553 | $background['color'] = isset($param['backcolor']) ? $this->parsingCss->convertToColor($param['backcolor'], $res) : null; |
2327 | - if (!$res) $background['color'] = null; |
|
2554 | + if (!$res) { |
|
2555 | + $background['color'] = null; |
|
2556 | + } |
|
2328 | 2557 | |
2329 | 2558 | $this->parsingCss->save(); |
2330 | 2559 | $this->parsingCss->analyse('PAGE', $param); |
@@ -2337,7 +2566,9 @@ discard block |
||
2337 | 2566 | // automatic footer |
2338 | 2567 | if (isset($param['footer'])) { |
2339 | 2568 | $lst = explode(';', $param['footer']); |
2340 | - foreach ($lst as $key => $val) $lst[$key] = trim(strtolower($val)); |
|
2569 | + foreach ($lst as $key => $val) { |
|
2570 | + $lst[$key] = trim(strtolower($val)); |
|
2571 | + } |
|
2341 | 2572 | $page = in_array('page', $lst); |
2342 | 2573 | $date = in_array('date', $lst); |
2343 | 2574 | $hour = in_array('heure', $lst); |
@@ -2371,14 +2602,18 @@ discard block |
||
2371 | 2602 | */ |
2372 | 2603 | protected function _tag_close_PAGE($param) |
2373 | 2604 | { |
2374 | - if ($this->_isForOneLine) return false; |
|
2605 | + if ($this->_isForOneLine) { |
|
2606 | + return false; |
|
2607 | + } |
|
2375 | 2608 | |
2376 | 2609 | $this->_maxH = 0; |
2377 | 2610 | |
2378 | 2611 | $this->parsingCss->load(); |
2379 | 2612 | $this->parsingCss->fontSet(); |
2380 | 2613 | |
2381 | - if ($this->_debugActif) $this->_DEBUG_add('PAGE '.$this->_page, false); |
|
2614 | + if ($this->_debugActif) { |
|
2615 | + $this->_DEBUG_add('PAGE '.$this->_page, false); |
|
2616 | + } |
|
2382 | 2617 | |
2383 | 2618 | return true; |
2384 | 2619 | } |
@@ -2392,14 +2627,20 @@ discard block |
||
2392 | 2627 | */ |
2393 | 2628 | protected function _tag_open_PAGE_HEADER($param) |
2394 | 2629 | { |
2395 | - if ($this->_isForOneLine) return false; |
|
2630 | + if ($this->_isForOneLine) { |
|
2631 | + return false; |
|
2632 | + } |
|
2396 | 2633 | |
2397 | 2634 | $this->_subHEADER = array(); |
2398 | 2635 | for ($this->_parsePos; $this->_parsePos<count($this->parsingHtml->code); $this->_parsePos++) { |
2399 | 2636 | $action = $this->parsingHtml->code[$this->_parsePos]; |
2400 | - if ($action['name']=='page_header') $action['name']='page_header_sub'; |
|
2637 | + if ($action['name']=='page_header') { |
|
2638 | + $action['name']='page_header_sub'; |
|
2639 | + } |
|
2401 | 2640 | $this->_subHEADER[] = $action; |
2402 | - if (strtolower($action['name'])=='page_header_sub' && $action['close']) break; |
|
2641 | + if (strtolower($action['name'])=='page_header_sub' && $action['close']) { |
|
2642 | + break; |
|
2643 | + } |
|
2403 | 2644 | } |
2404 | 2645 | |
2405 | 2646 | $this->_setPageHeader(); |
@@ -2416,14 +2657,20 @@ discard block |
||
2416 | 2657 | */ |
2417 | 2658 | protected function _tag_open_PAGE_FOOTER($param) |
2418 | 2659 | { |
2419 | - if ($this->_isForOneLine) return false; |
|
2660 | + if ($this->_isForOneLine) { |
|
2661 | + return false; |
|
2662 | + } |
|
2420 | 2663 | |
2421 | 2664 | $this->_subFOOTER = array(); |
2422 | 2665 | for ($this->_parsePos; $this->_parsePos<count($this->parsingHtml->code); $this->_parsePos++) { |
2423 | 2666 | $action = $this->parsingHtml->code[$this->_parsePos]; |
2424 | - if ($action['name']=='page_footer') $action['name']='page_footer_sub'; |
|
2667 | + if ($action['name']=='page_footer') { |
|
2668 | + $action['name']='page_footer_sub'; |
|
2669 | + } |
|
2425 | 2670 | $this->_subFOOTER[] = $action; |
2426 | - if (strtolower($action['name'])=='page_footer_sub' && $action['close']) break; |
|
2671 | + if (strtolower($action['name'])=='page_footer_sub' && $action['close']) { |
|
2672 | + break; |
|
2673 | + } |
|
2427 | 2674 | } |
2428 | 2675 | |
2429 | 2676 | $this->_setPageFooter(); |
@@ -2439,7 +2686,9 @@ discard block |
||
2439 | 2686 | */ |
2440 | 2687 | protected function _tag_open_PAGE_HEADER_SUB($param) |
2441 | 2688 | { |
2442 | - if ($this->_isForOneLine) return false; |
|
2689 | + if ($this->_isForOneLine) { |
|
2690 | + return false; |
|
2691 | + } |
|
2443 | 2692 | |
2444 | 2693 | // save the current stat |
2445 | 2694 | $this->_subSTATES = array(); |
@@ -2484,7 +2733,9 @@ discard block |
||
2484 | 2733 | */ |
2485 | 2734 | protected function _tag_close_PAGE_HEADER_SUB($param) |
2486 | 2735 | { |
2487 | - if ($this->_isForOneLine) return false; |
|
2736 | + if ($this->_isForOneLine) { |
|
2737 | + return false; |
|
2738 | + } |
|
2488 | 2739 | |
2489 | 2740 | $this->parsingCss->load(); |
2490 | 2741 | |
@@ -2515,7 +2766,9 @@ discard block |
||
2515 | 2766 | */ |
2516 | 2767 | protected function _tag_open_PAGE_FOOTER_SUB($param) |
2517 | 2768 | { |
2518 | - if ($this->_isForOneLine) return false; |
|
2769 | + if ($this->_isForOneLine) { |
|
2770 | + return false; |
|
2771 | + } |
|
2519 | 2772 | |
2520 | 2773 | // save the current stat |
2521 | 2774 | $this->_subSTATES = array(); |
@@ -2569,7 +2822,9 @@ discard block |
||
2569 | 2822 | */ |
2570 | 2823 | protected function _tag_close_PAGE_FOOTER_SUB($param) |
2571 | 2824 | { |
2572 | - if ($this->_isForOneLine) return false; |
|
2825 | + if ($this->_isForOneLine) { |
|
2826 | + return false; |
|
2827 | + } |
|
2573 | 2828 | |
2574 | 2829 | $this->parsingCss->load(); |
2575 | 2830 | |
@@ -2599,7 +2854,9 @@ discard block |
||
2599 | 2854 | */ |
2600 | 2855 | protected function _tag_open_NOBREAK($param) |
2601 | 2856 | { |
2602 | - if ($this->_isForOneLine) return false; |
|
2857 | + if ($this->_isForOneLine) { |
|
2858 | + return false; |
|
2859 | + } |
|
2603 | 2860 | |
2604 | 2861 | $this->_maxH = 0; |
2605 | 2862 | |
@@ -2634,7 +2891,9 @@ discard block |
||
2634 | 2891 | */ |
2635 | 2892 | protected function _tag_close_NOBREAK($param) |
2636 | 2893 | { |
2637 | - if ($this->_isForOneLine) return false; |
|
2894 | + if ($this->_isForOneLine) { |
|
2895 | + return false; |
|
2896 | + } |
|
2638 | 2897 | |
2639 | 2898 | $this->_maxH = 0; |
2640 | 2899 | |
@@ -2651,8 +2910,12 @@ discard block |
||
2651 | 2910 | */ |
2652 | 2911 | protected function _tag_open_DIV($param, $other = 'div') |
2653 | 2912 | { |
2654 | - if ($this->_isForOneLine) return false; |
|
2655 | - if ($this->_debugActif) $this->_DEBUG_add(strtoupper($other), true); |
|
2913 | + if ($this->_isForOneLine) { |
|
2914 | + return false; |
|
2915 | + } |
|
2916 | + if ($this->_debugActif) { |
|
2917 | + $this->_DEBUG_add(strtoupper($other), true); |
|
2918 | + } |
|
2656 | 2919 | |
2657 | 2920 | $this->parsingCss->save(); |
2658 | 2921 | $this->parsingCss->analyse($other, $param); |
@@ -2660,13 +2923,21 @@ discard block |
||
2660 | 2923 | |
2661 | 2924 | // for fieldset and legend |
2662 | 2925 | if (in_array($other, array('fieldset', 'legend'))) { |
2663 | - if (isset($param['moveTop'])) $this->parsingCss->value['margin']['t'] += $param['moveTop']; |
|
2664 | - if (isset($param['moveLeft'])) $this->parsingCss->value['margin']['l'] += $param['moveLeft']; |
|
2665 | - if (isset($param['moveDown'])) $this->parsingCss->value['margin']['b'] += $param['moveDown']; |
|
2926 | + if (isset($param['moveTop'])) { |
|
2927 | + $this->parsingCss->value['margin']['t'] += $param['moveTop']; |
|
2928 | + } |
|
2929 | + if (isset($param['moveLeft'])) { |
|
2930 | + $this->parsingCss->value['margin']['l'] += $param['moveLeft']; |
|
2931 | + } |
|
2932 | + if (isset($param['moveDown'])) { |
|
2933 | + $this->parsingCss->value['margin']['b'] += $param['moveDown']; |
|
2934 | + } |
|
2666 | 2935 | } |
2667 | 2936 | |
2668 | 2937 | $alignObject = null; |
2669 | - if ($this->parsingCss->value['margin-auto']) $alignObject = 'center'; |
|
2938 | + if ($this->parsingCss->value['margin-auto']) { |
|
2939 | + $alignObject = 'center'; |
|
2940 | + } |
|
2670 | 2941 | |
2671 | 2942 | $marge = array(); |
2672 | 2943 | $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03; |
@@ -2752,22 +3023,27 @@ discard block |
||
2752 | 3023 | if ( |
2753 | 3024 | $w < ($this->pdf->getW() - $this->pdf->getlMargin()-$this->pdf->getrMargin()) && |
2754 | 3025 | $this->pdf->getX() + $w>=($this->pdf->getW() - $this->pdf->getrMargin()) |
2755 | - ) |
|
2756 | - $this->_tag_open_BR(array()); |
|
3026 | + ) { |
|
3027 | + $this->_tag_open_BR(array()); |
|
3028 | + } |
|
2757 | 3029 | |
2758 | 3030 | if ( |
2759 | 3031 | ($h < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin())) && |
2760 | 3032 | ($this->pdf->getY() + $h>=($this->pdf->getH() - $this->pdf->getbMargin())) && |
2761 | 3033 | !$this->_isInOverflow |
2762 | - ) |
|
2763 | - $this->_setNewPage(); |
|
3034 | + ) { |
|
3035 | + $this->_setNewPage(); |
|
3036 | + } |
|
2764 | 3037 | |
2765 | 3038 | $old = $this->parsingCss->getOldValues(); |
2766 | 3039 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
2767 | 3040 | |
2768 | 3041 | if ($parentWidth>$w) { |
2769 | - if ($alignObject=='center') $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
2770 | - else if ($alignObject=='right') $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
3042 | + if ($alignObject=='center') { |
|
3043 | + $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
3044 | + } else if ($alignObject=='right') { |
|
3045 | + $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
3046 | + } |
|
2771 | 3047 | } |
2772 | 3048 | |
2773 | 3049 | $this->parsingCss->setPosition(); |
@@ -2776,8 +3052,11 @@ discard block |
||
2776 | 3052 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
2777 | 3053 | |
2778 | 3054 | if ($parentWidth>$w) { |
2779 | - if ($alignObject=='center') $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
2780 | - else if ($alignObject=='right') $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
3055 | + if ($alignObject=='center') { |
|
3056 | + $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
3057 | + } else if ($alignObject=='right') { |
|
3058 | + $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
3059 | + } |
|
2781 | 3060 | } |
2782 | 3061 | |
2783 | 3062 | $this->parsingCss->setPosition(); |
@@ -2826,7 +3105,9 @@ discard block |
||
2826 | 3105 | $xCorr = ($this->parsingCss->value['width']-$wReel)*0.5; |
2827 | 3106 | break; |
2828 | 3107 | } |
2829 | - if ($xCorr>0) $xCorr=0; |
|
3108 | + if ($xCorr>0) { |
|
3109 | + $xCorr=0; |
|
3110 | + } |
|
2830 | 3111 | switch($this->parsingCss->value['vertical-align']) |
2831 | 3112 | { |
2832 | 3113 | case 'bottom': |
@@ -2910,7 +3191,9 @@ discard block |
||
2910 | 3191 | // get height of LEGEND element and make fieldset corrections |
2911 | 3192 | for ($tempPos = $this->_parsePos + 1; $tempPos<count($this->parsingHtml->code); $tempPos++) { |
2912 | 3193 | $action = $this->parsingHtml->code[$tempPos]; |
2913 | - if ($action['name'] == 'fieldset') break; |
|
3194 | + if ($action['name'] == 'fieldset') { |
|
3195 | + break; |
|
3196 | + } |
|
2914 | 3197 | if ($action['name'] == 'legend' && !$action['close']) { |
2915 | 3198 | $legendOpenPos = $tempPos; |
2916 | 3199 | |
@@ -2923,8 +3206,9 @@ discard block |
||
2923 | 3206 | $action = $sub->parsingHtml->code[$sub->_parsePos]; |
2924 | 3207 | $sub->_executeAction($action); |
2925 | 3208 | |
2926 | - if ($action['name'] == 'legend' && $action['close']) |
|
2927 | - break; |
|
3209 | + if ($action['name'] == 'legend' && $action['close']) { |
|
3210 | + break; |
|
3211 | + } |
|
2928 | 3212 | } |
2929 | 3213 | |
2930 | 3214 | $legendH = $sub->_maxY; |
@@ -2955,7 +3239,9 @@ discard block |
||
2955 | 3239 | */ |
2956 | 3240 | protected function _tag_close_DIV($param, $other='div') |
2957 | 3241 | { |
2958 | - if ($this->_isForOneLine) return false; |
|
3242 | + if ($this->_isForOneLine) { |
|
3243 | + return false; |
|
3244 | + } |
|
2959 | 3245 | |
2960 | 3246 | if ($this->parsingCss->value['overflow']=='hidden') { |
2961 | 3247 | $this->_maxX = $this->parsingCss->value['old_maxX']; |
@@ -2965,8 +3251,9 @@ discard block |
||
2965 | 3251 | $this->pdf->clippingPathStop(); |
2966 | 3252 | } |
2967 | 3253 | |
2968 | - if ($this->parsingCss->value['rotate']) |
|
2969 | - $this->pdf->stopTransform(); |
|
3254 | + if ($this->parsingCss->value['rotate']) { |
|
3255 | + $this->pdf->stopTransform(); |
|
3256 | + } |
|
2970 | 3257 | |
2971 | 3258 | $marge = array(); |
2972 | 3259 | $marge['l'] = $this->parsingCss->value['border']['l']['width'] + $this->parsingCss->value['padding']['l']+0.03; |
@@ -3012,8 +3299,12 @@ discard block |
||
3012 | 3299 | $this->parsingCss->fontSet(); |
3013 | 3300 | $this->_loadMargin(); |
3014 | 3301 | |
3015 | - if ($block) $this->_tag_open_BR(array()); |
|
3016 | - if ($this->_debugActif) $this->_DEBUG_add(strtoupper($other), false); |
|
3302 | + if ($block) { |
|
3303 | + $this->_tag_open_BR(array()); |
|
3304 | + } |
|
3305 | + if ($this->_debugActif) { |
|
3306 | + $this->_DEBUG_add(strtoupper($other), false); |
|
3307 | + } |
|
3017 | 3308 | |
3018 | 3309 | return true; |
3019 | 3310 | } |
@@ -3068,16 +3359,27 @@ discard block |
||
3068 | 3359 | $lstBarcode['UPC_A'] = 'UPCA'; |
3069 | 3360 | $lstBarcode['CODE39'] = 'C39'; |
3070 | 3361 | |
3071 | - if (!isset($param['type'])) $param['type'] = 'C39'; |
|
3072 | - if (!isset($param['value'])) $param['value'] = 0; |
|
3073 | - if (!isset($param['label'])) $param['label'] = 'label'; |
|
3074 | - if (!isset($param['style']['color'])) $param['style']['color'] = '#000000'; |
|
3362 | + if (!isset($param['type'])) { |
|
3363 | + $param['type'] = 'C39'; |
|
3364 | + } |
|
3365 | + if (!isset($param['value'])) { |
|
3366 | + $param['value'] = 0; |
|
3367 | + } |
|
3368 | + if (!isset($param['label'])) { |
|
3369 | + $param['label'] = 'label'; |
|
3370 | + } |
|
3371 | + if (!isset($param['style']['color'])) { |
|
3372 | + $param['style']['color'] = '#000000'; |
|
3373 | + } |
|
3075 | 3374 | |
3076 | - if ($this->_testIsDeprecated && (isset($param['bar_h']) || isset($param['bar_w']))) |
|
3077 | - throw new HTML2PDF_exception(9, array('BARCODE', 'bar_h, bar_w')); |
|
3375 | + if ($this->_testIsDeprecated && (isset($param['bar_h']) || isset($param['bar_w']))) { |
|
3376 | + throw new HTML2PDF_exception(9, array('BARCODE', 'bar_h, bar_w')); |
|
3377 | + } |
|
3078 | 3378 | |
3079 | 3379 | $param['type'] = strtoupper($param['type']); |
3080 | - if (isset($lstBarcode[$param['type']])) $param['type'] = $lstBarcode[$param['type']]; |
|
3380 | + if (isset($lstBarcode[$param['type']])) { |
|
3381 | + $param['type'] = $lstBarcode[$param['type']]; |
|
3382 | + } |
|
3081 | 3383 | |
3082 | 3384 | $this->parsingCss->save(); |
3083 | 3385 | $this->parsingCss->analyse('barcode', $param); |
@@ -3086,8 +3388,12 @@ discard block |
||
3086 | 3388 | |
3087 | 3389 | $x = $this->pdf->getX(); |
3088 | 3390 | $y = $this->pdf->getY(); |
3089 | - $w = $this->parsingCss->value['width']; if (!$w) $w = $this->parsingCss->ConvertToMM('50mm'); |
|
3090 | - $h = $this->parsingCss->value['height']; if (!$h) $h = $this->parsingCss->ConvertToMM('10mm'); |
|
3391 | + $w = $this->parsingCss->value['width']; if (!$w) { |
|
3392 | + $w = $this->parsingCss->ConvertToMM('50mm'); |
|
3393 | + } |
|
3394 | + $h = $this->parsingCss->value['height']; if (!$h) { |
|
3395 | + $h = $this->parsingCss->ConvertToMM('10mm'); |
|
3396 | + } |
|
3091 | 3397 | $txt = ($param['label']!=='none' ? $this->parsingCss->value['font-size'] : false); |
3092 | 3398 | $c = $this->parsingCss->value['color']; |
3093 | 3399 | $infos = $this->pdf->myBarcode($param['value'], $param['type'], $x, $y, $w, $h, $txt, $c); |
@@ -3128,15 +3434,26 @@ discard block |
||
3128 | 3434 | */ |
3129 | 3435 | protected function _tag_open_QRCODE($param) |
3130 | 3436 | { |
3131 | - if ($this->_testIsDeprecated && (isset($param['size']) || isset($param['noborder']))) |
|
3132 | - throw new HTML2PDF_exception(9, array('QRCODE', 'size, noborder')); |
|
3437 | + if ($this->_testIsDeprecated && (isset($param['size']) || isset($param['noborder']))) { |
|
3438 | + throw new HTML2PDF_exception(9, array('QRCODE', 'size, noborder')); |
|
3439 | + } |
|
3133 | 3440 | |
3134 | - if ($this->_debugActif) $this->_DEBUG_add('QRCODE'); |
|
3441 | + if ($this->_debugActif) { |
|
3442 | + $this->_DEBUG_add('QRCODE'); |
|
3443 | + } |
|
3135 | 3444 | |
3136 | - if (!isset($param['value'])) $param['value'] = ''; |
|
3137 | - if (!isset($param['ec'])) $param['ec'] = 'H'; |
|
3138 | - if (!isset($param['style']['color'])) $param['style']['color'] = '#000000'; |
|
3139 | - if (!isset($param['style']['background-color'])) $param['style']['background-color'] = '#FFFFFF'; |
|
3445 | + if (!isset($param['value'])) { |
|
3446 | + $param['value'] = ''; |
|
3447 | + } |
|
3448 | + if (!isset($param['ec'])) { |
|
3449 | + $param['ec'] = 'H'; |
|
3450 | + } |
|
3451 | + if (!isset($param['style']['color'])) { |
|
3452 | + $param['style']['color'] = '#000000'; |
|
3453 | + } |
|
3454 | + if (!isset($param['style']['background-color'])) { |
|
3455 | + $param['style']['background-color'] = '#FFFFFF'; |
|
3456 | + } |
|
3140 | 3457 | if (isset($param['style']['border'])) { |
3141 | 3458 | $borders = $param['style']['border']!='none'; |
3142 | 3459 | unset($param['style']['border']); |
@@ -3144,8 +3461,12 @@ discard block |
||
3144 | 3461 | $borders = true; |
3145 | 3462 | } |
3146 | 3463 | |
3147 | - if ($param['value']==='') return true; |
|
3148 | - if (!in_array($param['ec'], array('L', 'M', 'Q', 'H'))) $param['ec'] = 'H'; |
|
3464 | + if ($param['value']==='') { |
|
3465 | + return true; |
|
3466 | + } |
|
3467 | + if (!in_array($param['ec'], array('L', 'M', 'Q', 'H'))) { |
|
3468 | + $param['ec'] = 'H'; |
|
3469 | + } |
|
3149 | 3470 | |
3150 | 3471 | $this->parsingCss->save(); |
3151 | 3472 | $this->parsingCss->analyse('qrcode', $param); |
@@ -3156,7 +3477,9 @@ discard block |
||
3156 | 3477 | $y = $this->pdf->getY(); |
3157 | 3478 | $w = $this->parsingCss->value['width']; |
3158 | 3479 | $h = $this->parsingCss->value['height']; |
3159 | - $size = max($w, $h); if (!$size) $size = $this->parsingCss->ConvertToMM('50mm'); |
|
3480 | + $size = max($w, $h); if (!$size) { |
|
3481 | + $size = $this->parsingCss->ConvertToMM('50mm'); |
|
3482 | + } |
|
3160 | 3483 | |
3161 | 3484 | $style = array( |
3162 | 3485 | 'fgcolor' => $this->parsingCss->value['color'], |
@@ -3214,8 +3537,12 @@ discard block |
||
3214 | 3537 | $titre = isset($param['title']) ? trim($param['title']) : ''; |
3215 | 3538 | $level = isset($param['level']) ? floor($param['level']) : 0; |
3216 | 3539 | |
3217 | - if ($level<0) $level = 0; |
|
3218 | - if ($titre) $this->pdf->Bookmark($titre, $level, -1); |
|
3540 | + if ($level<0) { |
|
3541 | + $level = 0; |
|
3542 | + } |
|
3543 | + if ($titre) { |
|
3544 | + $this->pdf->Bookmark($titre, $level, -1); |
|
3545 | + } |
|
3219 | 3546 | |
3220 | 3547 | return true; |
3221 | 3548 | } |
@@ -3259,12 +3586,13 @@ discard block |
||
3259 | 3586 | $txt = str_replace('[[page_cu]]', $this->pdf->getMyNumPage($this->_page), $txt); |
3260 | 3587 | |
3261 | 3588 | if ($this->parsingCss->value['text-transform']!='none') { |
3262 | - if ($this->parsingCss->value['text-transform']=='capitalize') |
|
3263 | - $txt = ucwords($txt); |
|
3264 | - else if ($this->parsingCss->value['text-transform']=='uppercase') |
|
3265 | - $txt = strtoupper($txt); |
|
3266 | - else if ($this->parsingCss->value['text-transform']=='lowercase') |
|
3267 | - $txt = strtolower($txt); |
|
3589 | + if ($this->parsingCss->value['text-transform']=='capitalize') { |
|
3590 | + $txt = ucwords($txt); |
|
3591 | + } else if ($this->parsingCss->value['text-transform']=='uppercase') { |
|
3592 | + $txt = strtoupper($txt); |
|
3593 | + } else if ($this->parsingCss->value['text-transform']=='lowercase') { |
|
3594 | + $txt = strtolower($txt); |
|
3595 | + } |
|
3268 | 3596 | } |
3269 | 3597 | |
3270 | 3598 | // size of the text |
@@ -3320,7 +3648,9 @@ discard block |
||
3320 | 3648 | array_shift($words); |
3321 | 3649 | $old = $str; |
3322 | 3650 | |
3323 | - if (!count($words)) break; |
|
3651 | + if (!count($words)) { |
|
3652 | + break; |
|
3653 | + } |
|
3324 | 3654 | $str[0].= ' '.$words[0][0]; |
3325 | 3655 | $str[1]+= $space+$words[0][1]; |
3326 | 3656 | } |
@@ -3337,7 +3667,9 @@ discard block |
||
3337 | 3667 | |
3338 | 3668 | // write the extract sentence that fit on the page |
3339 | 3669 | $wc = ($align=='L' ? $str[1] : $this->parsingCss->value['width']); |
3340 | - if ($right - $left<$wc) $wc = $right - $left; |
|
3670 | + if ($right - $left<$wc) { |
|
3671 | + $wc = $right - $left; |
|
3672 | + } |
|
3341 | 3673 | |
3342 | 3674 | if (strlen($str[0])) { |
3343 | 3675 | $this->pdf->setXY($this->pdf->getX(), $y+$dh+$dy); |
@@ -3358,7 +3690,9 @@ discard block |
||
3358 | 3690 | // if we have again words to write |
3359 | 3691 | if (count($words)) { |
3360 | 3692 | // remove the space at the end |
3361 | - if ($add) $w-= $space; |
|
3693 | + if ($add) { |
|
3694 | + $w-= $space; |
|
3695 | + } |
|
3362 | 3696 | |
3363 | 3697 | // if we don't add any word, and if the first word is empty => useless space to skip |
3364 | 3698 | if (!$add && $words[0][0]==='') { |
@@ -3393,7 +3727,9 @@ discard block |
||
3393 | 3727 | // if more than 10000 line => error |
3394 | 3728 | $nb++; |
3395 | 3729 | if ($nb>10000) { |
3396 | - $txt = ''; foreach ($words as $k => $word) $txt.= ($k ? ' ' : '').$word[0]; |
|
3730 | + $txt = ''; foreach ($words as $k => $word) { |
|
3731 | + $txt.= ($k ? ' ' : '').$word[0]; |
|
3732 | + } |
|
3397 | 3733 | throw new HTML2PDF_exception(2, array($txt, $right-$left, $w)); |
3398 | 3734 | } |
3399 | 3735 | |
@@ -3404,7 +3740,9 @@ discard block |
||
3404 | 3740 | |
3405 | 3741 | // if we have words after automatic cut, it is because they fit on the line => we write the text |
3406 | 3742 | if (count($words)) { |
3407 | - $txt = ''; foreach ($words as $k => $word) $txt.= ($k ? ' ' : '').$word[0]; |
|
3743 | + $txt = ''; foreach ($words as $k => $word) { |
|
3744 | + $txt.= ($k ? ' ' : '').$word[0]; |
|
3745 | + } |
|
3408 | 3746 | $w+= $this->pdf->getWordSpacing()*(count($words)); |
3409 | 3747 | $this->pdf->setXY($this->pdf->getX(), $y+$dh+$dy); |
3410 | 3748 | $this->pdf->Cell(($align=='L' ? $w : $this->parsingCss->value['width']), $h, $txt, 0, 0, $align, $fill, $this->_isInLink); |
@@ -3432,11 +3770,15 @@ discard block |
||
3432 | 3770 | */ |
3433 | 3771 | protected function _tag_open_BR($param, $curr = null) |
3434 | 3772 | { |
3435 | - if ($this->_isForOneLine) return false; |
|
3773 | + if ($this->_isForOneLine) { |
|
3774 | + return false; |
|
3775 | + } |
|
3436 | 3776 | |
3437 | 3777 | $h = max($this->_maxH, $this->parsingCss->getLineHeight()); |
3438 | 3778 | |
3439 | - if ($this->_maxH==0) $this->_maxY = max($this->_maxY, $this->pdf->getY()+$h); |
|
3779 | + if ($this->_maxH==0) { |
|
3780 | + $this->_maxY = max($this->_maxY, $this->pdf->getY()+$h); |
|
3781 | + } |
|
3440 | 3782 | |
3441 | 3783 | $this->_makeBreakLine($h, $curr); |
3442 | 3784 | |
@@ -3455,11 +3797,15 @@ discard block |
||
3455 | 3797 | */ |
3456 | 3798 | protected function _tag_open_HR($param) |
3457 | 3799 | { |
3458 | - if ($this->_isForOneLine) return false; |
|
3800 | + if ($this->_isForOneLine) { |
|
3801 | + return false; |
|
3802 | + } |
|
3459 | 3803 | $oldAlign = $this->parsingCss->value['text-align']; |
3460 | 3804 | $this->parsingCss->value['text-align'] = 'left'; |
3461 | 3805 | |
3462 | - if ($this->_maxH) $this->_tag_open_BR($param); |
|
3806 | + if ($this->_maxH) { |
|
3807 | + $this->_tag_open_BR($param); |
|
3808 | + } |
|
3463 | 3809 | |
3464 | 3810 | $fontSize = $this->parsingCss->value['font-size']; |
3465 | 3811 | $this->parsingCss->value['font-size']=$fontSize*0.5; $this->_tag_open_BR($param); |
@@ -3475,8 +3821,12 @@ discard block |
||
3475 | 3821 | $this->parsingCss->fontSet(); |
3476 | 3822 | |
3477 | 3823 | $h = $this->parsingCss->value['height']; |
3478 | - if ($h) $h-= $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width']; |
|
3479 | - if ($h<=0) $h = $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width']; |
|
3824 | + if ($h) { |
|
3825 | + $h-= $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width']; |
|
3826 | + } |
|
3827 | + if ($h<=0) { |
|
3828 | + $h = $this->parsingCss->value['border']['t']['width']+$this->parsingCss->value['border']['b']['width']; |
|
3829 | + } |
|
3480 | 3830 | |
3481 | 3831 | $this->_drawRectangle($this->pdf->getX(), $this->pdf->getY(), $this->parsingCss->value['width'], $h, $this->parsingCss->value['border'], 0, 0, $this->parsingCss->value['background']); |
3482 | 3832 | $this->_maxH = $h; |
@@ -3812,7 +4162,9 @@ discard block |
||
3812 | 4162 | |
3813 | 4163 | if (isset($param['name'])) { |
3814 | 4164 | $name = $param['name']; |
3815 | - if (!isset($this->_lstAnchor[$name])) $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false); |
|
4165 | + if (!isset($this->_lstAnchor[$name])) { |
|
4166 | + $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false); |
|
4167 | + } |
|
3816 | 4168 | |
3817 | 4169 | if (!$this->_lstAnchor[$name][1]) { |
3818 | 4170 | $this->_lstAnchor[$name][1] = true; |
@@ -3822,7 +4174,9 @@ discard block |
||
3822 | 4174 | |
3823 | 4175 | if (preg_match('/^#([^#]+)$/isU', $this->_isInLink, $match)) { |
3824 | 4176 | $name = $match[1]; |
3825 | - if (!isset($this->_lstAnchor[$name])) $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false); |
|
4177 | + if (!isset($this->_lstAnchor[$name])) { |
|
4178 | + $this->_lstAnchor[$name] = array($this->pdf->AddLink(), false); |
|
4179 | + } |
|
3826 | 4180 | |
3827 | 4181 | $this->_isInLink = $this->_lstAnchor[$name][0]; |
3828 | 4182 | } |
@@ -3863,9 +4217,13 @@ discard block |
||
3863 | 4217 | */ |
3864 | 4218 | protected function _tag_open_H1($param, $other = 'h1') |
3865 | 4219 | { |
3866 | - if ($this->_isForOneLine) return false; |
|
4220 | + if ($this->_isForOneLine) { |
|
4221 | + return false; |
|
4222 | + } |
|
3867 | 4223 | |
3868 | - if ($this->_maxH) $this->_tag_open_BR(array()); |
|
4224 | + if ($this->_maxH) { |
|
4225 | + $this->_tag_open_BR(array()); |
|
4226 | + } |
|
3869 | 4227 | $this->parsingCss->save(); |
3870 | 4228 | $this->parsingCss->value['font-bold'] = true; |
3871 | 4229 | |
@@ -3953,7 +4311,9 @@ discard block |
||
3953 | 4311 | */ |
3954 | 4312 | protected function _tag_close_H1($param) |
3955 | 4313 | { |
3956 | - if ($this->_isForOneLine) return false; |
|
4314 | + if ($this->_isForOneLine) { |
|
4315 | + return false; |
|
4316 | + } |
|
3957 | 4317 | |
3958 | 4318 | $this->_maxH+= $this->parsingCss->value['margin']['b']; |
3959 | 4319 | $h = max($this->_maxH, $this->parsingCss->getLineHeight()); |
@@ -4120,10 +4480,14 @@ discard block |
||
4120 | 4480 | */ |
4121 | 4481 | protected function _tag_open_P($param) |
4122 | 4482 | { |
4123 | - if ($this->_isForOneLine) return false; |
|
4483 | + if ($this->_isForOneLine) { |
|
4484 | + return false; |
|
4485 | + } |
|
4124 | 4486 | |
4125 | 4487 | if (!in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) { |
4126 | - if ($this->_maxH) $this->_tag_open_BR(array()); |
|
4488 | + if ($this->_maxH) { |
|
4489 | + $this->_tag_open_BR(array()); |
|
4490 | + } |
|
4127 | 4491 | } |
4128 | 4492 | |
4129 | 4493 | $this->parsingCss->save(); |
@@ -4160,9 +4524,13 @@ discard block |
||
4160 | 4524 | */ |
4161 | 4525 | protected function _tag_close_P($param) |
4162 | 4526 | { |
4163 | - if ($this->_isForOneLine) return false; |
|
4527 | + if ($this->_isForOneLine) { |
|
4528 | + return false; |
|
4529 | + } |
|
4164 | 4530 | |
4165 | - if ($this->_maxH) $this->_tag_open_BR(array()); |
|
4531 | + if ($this->_maxH) { |
|
4532 | + $this->_tag_open_BR(array()); |
|
4533 | + } |
|
4166 | 4534 | $this->_isInParagraph = false; |
4167 | 4535 | $this->_loadMargin(); |
4168 | 4536 | $h = $this->parsingCss->value['margin']['b']+$this->parsingCss->value['padding']['b']; |
@@ -4184,7 +4552,9 @@ discard block |
||
4184 | 4552 | */ |
4185 | 4553 | protected function _tag_open_PRE($param, $other = 'pre') |
4186 | 4554 | { |
4187 | - if ($other=='pre' && $this->_maxH) $this->_tag_open_BR(array()); |
|
4555 | + if ($other=='pre' && $this->_maxH) { |
|
4556 | + $this->_tag_open_BR(array()); |
|
4557 | + } |
|
4188 | 4558 | |
4189 | 4559 | $this->parsingCss->save(); |
4190 | 4560 | $this->parsingCss->value['font-family'] = 'courier'; |
@@ -4192,7 +4562,9 @@ discard block |
||
4192 | 4562 | $this->parsingCss->setPosition(); |
4193 | 4563 | $this->parsingCss->fontSet(); |
4194 | 4564 | |
4195 | - if ($other=='pre') return $this->_tag_open_DIV($param, $other); |
|
4565 | + if ($other=='pre') { |
|
4566 | + return $this->_tag_open_DIV($param, $other); |
|
4567 | + } |
|
4196 | 4568 | |
4197 | 4569 | return true; |
4198 | 4570 | } |
@@ -4221,7 +4593,9 @@ discard block |
||
4221 | 4593 | protected function _tag_close_PRE($param, $other = 'pre') |
4222 | 4594 | { |
4223 | 4595 | if ($other=='pre') { |
4224 | - if ($this->_isForOneLine) return false; |
|
4596 | + if ($this->_isForOneLine) { |
|
4597 | + return false; |
|
4598 | + } |
|
4225 | 4599 | |
4226 | 4600 | $this->_tag_close_DIV($param, $other); |
4227 | 4601 | $this->_tag_open_BR(array()); |
@@ -4387,14 +4761,22 @@ discard block |
||
4387 | 4761 | */ |
4388 | 4762 | protected function _tag_open_UL($param, $other = 'ul') |
4389 | 4763 | { |
4390 | - if ($this->_isForOneLine) return false; |
|
4764 | + if ($this->_isForOneLine) { |
|
4765 | + return false; |
|
4766 | + } |
|
4391 | 4767 | |
4392 | 4768 | if (!in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) { |
4393 | - if ($this->_maxH) $this->_tag_open_BR(array()); |
|
4394 | - if (!count($this->_defList)) $this->_tag_open_BR(array()); |
|
4769 | + if ($this->_maxH) { |
|
4770 | + $this->_tag_open_BR(array()); |
|
4771 | + } |
|
4772 | + if (!count($this->_defList)) { |
|
4773 | + $this->_tag_open_BR(array()); |
|
4774 | + } |
|
4395 | 4775 | } |
4396 | 4776 | |
4397 | - if (!isset($param['style']['width'])) $param['allwidth'] = true; |
|
4777 | + if (!isset($param['style']['width'])) { |
|
4778 | + $param['allwidth'] = true; |
|
4779 | + } |
|
4398 | 4780 | $param['cellspacing'] = 0; |
4399 | 4781 | |
4400 | 4782 | // a list is like a table |
@@ -4427,14 +4809,18 @@ discard block |
||
4427 | 4809 | */ |
4428 | 4810 | protected function _tag_close_UL($param) |
4429 | 4811 | { |
4430 | - if ($this->_isForOneLine) return false; |
|
4812 | + if ($this->_isForOneLine) { |
|
4813 | + return false; |
|
4814 | + } |
|
4431 | 4815 | |
4432 | 4816 | $this->_tag_close_TABLE($param); |
4433 | 4817 | |
4434 | 4818 | $this->_listeDelLevel(); |
4435 | 4819 | |
4436 | 4820 | if (!$this->_subPart) { |
4437 | - if (!count($this->_defList)) $this->_tag_open_BR(array()); |
|
4821 | + if (!count($this->_defList)) { |
|
4822 | + $this->_tag_open_BR(array()); |
|
4823 | + } |
|
4438 | 4824 | } |
4439 | 4825 | |
4440 | 4826 | return true; |
@@ -4461,11 +4847,15 @@ discard block |
||
4461 | 4847 | */ |
4462 | 4848 | protected function _tag_open_LI($param) |
4463 | 4849 | { |
4464 | - if ($this->_isForOneLine) return false; |
|
4850 | + if ($this->_isForOneLine) { |
|
4851 | + return false; |
|
4852 | + } |
|
4465 | 4853 | |
4466 | 4854 | $this->_listeAddLi(); |
4467 | 4855 | |
4468 | - if (!isset($param['style']['width'])) $param['style']['width'] = '100%'; |
|
4856 | + if (!isset($param['style']['width'])) { |
|
4857 | + $param['style']['width'] = '100%'; |
|
4858 | + } |
|
4469 | 4859 | |
4470 | 4860 | $paramPUCE = $param; |
4471 | 4861 | |
@@ -4519,8 +4909,11 @@ discard block |
||
4519 | 4909 | // TD for the puce |
4520 | 4910 | $this->_tag_open_TD($paramPUCE, 'li_sub'); |
4521 | 4911 | unset($paramPUCE['style']['width']); |
4522 | - if (isset($paramPUCE['src'])) $this->_tag_open_IMG($paramPUCE); |
|
4523 | - else $this->_tag_open_WRITE($paramPUCE); |
|
4912 | + if (isset($paramPUCE['src'])) { |
|
4913 | + $this->_tag_open_IMG($paramPUCE); |
|
4914 | + } else { |
|
4915 | + $this->_tag_open_WRITE($paramPUCE); |
|
4916 | + } |
|
4524 | 4917 | $this->_tag_close_TD($paramPUCE); |
4525 | 4918 | } |
4526 | 4919 | $this->parsingCss->load(); |
@@ -4541,7 +4934,9 @@ discard block |
||
4541 | 4934 | */ |
4542 | 4935 | protected function _tag_close_LI($param) |
4543 | 4936 | { |
4544 | - if ($this->_isForOneLine) return false; |
|
4937 | + if ($this->_isForOneLine) { |
|
4938 | + return false; |
|
4939 | + } |
|
4545 | 4940 | |
4546 | 4941 | $this->_tag_close_TD($param); |
4547 | 4942 | |
@@ -4559,7 +4954,9 @@ discard block |
||
4559 | 4954 | */ |
4560 | 4955 | protected function _tag_open_TBODY($param) |
4561 | 4956 | { |
4562 | - if ($this->_isForOneLine) return false; |
|
4957 | + if ($this->_isForOneLine) { |
|
4958 | + return false; |
|
4959 | + } |
|
4563 | 4960 | |
4564 | 4961 | $this->parsingCss->save(); |
4565 | 4962 | $this->parsingCss->analyse('tbody', $param); |
@@ -4578,7 +4975,9 @@ discard block |
||
4578 | 4975 | */ |
4579 | 4976 | protected function _tag_close_TBODY($param) |
4580 | 4977 | { |
4581 | - if ($this->_isForOneLine) return false; |
|
4978 | + if ($this->_isForOneLine) { |
|
4979 | + return false; |
|
4980 | + } |
|
4582 | 4981 | |
4583 | 4982 | $this->parsingCss->load(); |
4584 | 4983 | $this->parsingCss->fontSet(); |
@@ -4595,7 +4994,9 @@ discard block |
||
4595 | 4994 | */ |
4596 | 4995 | protected function _tag_open_THEAD($param) |
4597 | 4996 | { |
4598 | - if ($this->_isForOneLine) return false; |
|
4997 | + if ($this->_isForOneLine) { |
|
4998 | + return false; |
|
4999 | + } |
|
4599 | 5000 | |
4600 | 5001 | $this->parsingCss->save(); |
4601 | 5002 | $this->parsingCss->analyse('thead', $param); |
@@ -4608,9 +5009,13 @@ discard block |
||
4608 | 5009 | HTML2PDF::$_tables[$param['num']]['thead']['code'] = array(); |
4609 | 5010 | for ($pos=$this->_tempPos; $pos<count($this->parsingHtml->code); $pos++) { |
4610 | 5011 | $action = $this->parsingHtml->code[$pos]; |
4611 | - if (strtolower($action['name'])=='thead') $action['name'] = 'thead_sub'; |
|
5012 | + if (strtolower($action['name'])=='thead') { |
|
5013 | + $action['name'] = 'thead_sub'; |
|
5014 | + } |
|
4612 | 5015 | HTML2PDF::$_tables[$param['num']]['thead']['code'][] = $action; |
4613 | - if (strtolower($action['name'])=='thead_sub' && $action['close']) break; |
|
5016 | + if (strtolower($action['name'])=='thead_sub' && $action['close']) { |
|
5017 | + break; |
|
5018 | + } |
|
4614 | 5019 | } |
4615 | 5020 | } else { |
4616 | 5021 | $level = $this->parsingHtml->getLevel($this->_parsePos); |
@@ -4630,7 +5035,9 @@ discard block |
||
4630 | 5035 | */ |
4631 | 5036 | protected function _tag_close_THEAD($param) |
4632 | 5037 | { |
4633 | - if ($this->_isForOneLine) return false; |
|
5038 | + if ($this->_isForOneLine) { |
|
5039 | + return false; |
|
5040 | + } |
|
4634 | 5041 | |
4635 | 5042 | $this->parsingCss->load(); |
4636 | 5043 | $this->parsingCss->fontSet(); |
@@ -4654,7 +5061,9 @@ discard block |
||
4654 | 5061 | */ |
4655 | 5062 | protected function _tag_open_TFOOT($param) |
4656 | 5063 | { |
4657 | - if ($this->_isForOneLine) return false; |
|
5064 | + if ($this->_isForOneLine) { |
|
5065 | + return false; |
|
5066 | + } |
|
4658 | 5067 | |
4659 | 5068 | $this->parsingCss->save(); |
4660 | 5069 | $this->parsingCss->analyse('tfoot', $param); |
@@ -4667,9 +5076,13 @@ discard block |
||
4667 | 5076 | HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array(); |
4668 | 5077 | for ($pos=$this->_tempPos; $pos<count($this->parsingHtml->code); $pos++) { |
4669 | 5078 | $action = $this->parsingHtml->code[$pos]; |
4670 | - if (strtolower($action['name'])=='tfoot') $action['name'] = 'tfoot_sub'; |
|
5079 | + if (strtolower($action['name'])=='tfoot') { |
|
5080 | + $action['name'] = 'tfoot_sub'; |
|
5081 | + } |
|
4671 | 5082 | HTML2PDF::$_tables[$param['num']]['tfoot']['code'][] = $action; |
4672 | - if (strtolower($action['name'])=='tfoot_sub' && $action['close']) break; |
|
5083 | + if (strtolower($action['name'])=='tfoot_sub' && $action['close']) { |
|
5084 | + break; |
|
5085 | + } |
|
4673 | 5086 | } |
4674 | 5087 | } else { |
4675 | 5088 | $level = $this->parsingHtml->getLevel($this->_parsePos); |
@@ -4689,7 +5102,9 @@ discard block |
||
4689 | 5102 | */ |
4690 | 5103 | protected function _tag_close_TFOOT($param) |
4691 | 5104 | { |
4692 | - if ($this->_isForOneLine) return false; |
|
5105 | + if ($this->_isForOneLine) { |
|
5106 | + return false; |
|
5107 | + } |
|
4693 | 5108 | |
4694 | 5109 | $this->parsingCss->load(); |
4695 | 5110 | $this->parsingCss->fontSet(); |
@@ -4712,7 +5127,9 @@ discard block |
||
4712 | 5127 | */ |
4713 | 5128 | protected function _tag_open_THEAD_SUB($param) |
4714 | 5129 | { |
4715 | - if ($this->_isForOneLine) return false; |
|
5130 | + if ($this->_isForOneLine) { |
|
5131 | + return false; |
|
5132 | + } |
|
4716 | 5133 | |
4717 | 5134 | $this->parsingCss->save(); |
4718 | 5135 | $this->parsingCss->analyse('thead', $param); |
@@ -4730,7 +5147,9 @@ discard block |
||
4730 | 5147 | */ |
4731 | 5148 | protected function _tag_close_THEAD_SUB($param) |
4732 | 5149 | { |
4733 | - if ($this->_isForOneLine) return false; |
|
5150 | + if ($this->_isForOneLine) { |
|
5151 | + return false; |
|
5152 | + } |
|
4734 | 5153 | |
4735 | 5154 | $this->parsingCss->load(); |
4736 | 5155 | $this->parsingCss->fontSet(); |
@@ -4746,7 +5165,9 @@ discard block |
||
4746 | 5165 | */ |
4747 | 5166 | protected function _tag_open_TFOOT_SUB($param) |
4748 | 5167 | { |
4749 | - if ($this->_isForOneLine) return false; |
|
5168 | + if ($this->_isForOneLine) { |
|
5169 | + return false; |
|
5170 | + } |
|
4750 | 5171 | |
4751 | 5172 | $this->parsingCss->save(); |
4752 | 5173 | $this->parsingCss->analyse('tfoot', $param); |
@@ -4764,7 +5185,9 @@ discard block |
||
4764 | 5185 | */ |
4765 | 5186 | protected function _tag_close_TFOOT_SUB($param) |
4766 | 5187 | { |
4767 | - if ($this->_isForOneLine) return false; |
|
5188 | + if ($this->_isForOneLine) { |
|
5189 | + return false; |
|
5190 | + } |
|
4768 | 5191 | |
4769 | 5192 | $this->parsingCss->load(); |
4770 | 5193 | $this->parsingCss->fontSet(); |
@@ -4826,7 +5249,9 @@ discard block |
||
4826 | 5249 | protected function _tag_open_TABLE($param, $other = 'table') |
4827 | 5250 | { |
4828 | 5251 | if ($this->_maxH) { |
4829 | - if ($this->_isForOneLine) return false; |
|
5252 | + if ($this->_isForOneLine) { |
|
5253 | + return false; |
|
5254 | + } |
|
4830 | 5255 | $this->_tag_open_BR(array()); |
4831 | 5256 | } |
4832 | 5257 | |
@@ -4838,15 +5263,21 @@ discard block |
||
4838 | 5263 | $this->_maxH = 0; |
4839 | 5264 | |
4840 | 5265 | $alignObject = isset($param['align']) ? strtolower($param['align']) : 'left'; |
4841 | - if (isset($param['align'])) unset($param['align']); |
|
4842 | - if (!in_array($alignObject, array('left', 'center', 'right'))) $alignObject = 'left'; |
|
5266 | + if (isset($param['align'])) { |
|
5267 | + unset($param['align']); |
|
5268 | + } |
|
5269 | + if (!in_array($alignObject, array('left', 'center', 'right'))) { |
|
5270 | + $alignObject = 'left'; |
|
5271 | + } |
|
4843 | 5272 | |
4844 | 5273 | $this->parsingCss->save(); |
4845 | 5274 | $this->parsingCss->analyse($other, $param); |
4846 | 5275 | $this->parsingCss->setPosition(); |
4847 | 5276 | $this->parsingCss->fontSet(); |
4848 | 5277 | |
4849 | - if ($this->parsingCss->value['margin-auto']) $alignObject = 'center'; |
|
5278 | + if ($this->parsingCss->value['margin-auto']) { |
|
5279 | + $alignObject = 'center'; |
|
5280 | + } |
|
4850 | 5281 | |
4851 | 5282 | // collapse table ? |
4852 | 5283 | $collapse = false; |
@@ -4867,7 +5298,9 @@ discard block |
||
4867 | 5298 | |
4868 | 5299 | // if we are in a SUB html => prepare the properties of the table |
4869 | 5300 | if ($this->_subPart) { |
4870 | - if ($this->_debugActif) $this->_DEBUG_add('Table n'.$param['num'], true); |
|
5301 | + if ($this->_debugActif) { |
|
5302 | + $this->_DEBUG_add('Table n'.$param['num'], true); |
|
5303 | + } |
|
4871 | 5304 | HTML2PDF::$_tables[$param['num']] = array(); |
4872 | 5305 | HTML2PDF::$_tables[$param['num']]['border'] = isset($param['border']) ? $this->parsingCss->readBorder($param['border']) : null; |
4873 | 5306 | HTML2PDF::$_tables[$param['num']]['cellpadding'] = $this->parsingCss->ConvertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px'); |
@@ -4939,7 +5372,9 @@ discard block |
||
4939 | 5372 | */ |
4940 | 5373 | protected function _tag_close_TABLE($param) |
4941 | 5374 | { |
4942 | - if ($this->_isForOneLine) return false; |
|
5375 | + if ($this->_isForOneLine) { |
|
5376 | + return false; |
|
5377 | + } |
|
4943 | 5378 | |
4944 | 5379 | $this->_maxH = 0; |
4945 | 5380 | |
@@ -4955,9 +5390,10 @@ discard block |
||
4955 | 5390 | foreach (HTML2PDF::$_tables[$param['num']][$mode]['tr'] as $tr) { |
4956 | 5391 | // hauteur de la ligne tr |
4957 | 5392 | $h = 0; |
4958 | - for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++) |
|
4959 | - if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan']==1) |
|
5393 | + for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++) { |
|
5394 | + if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan']==1) |
|
4960 | 5395 | $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['h']); |
5396 | + } |
|
4961 | 5397 | HTML2PDF::$_tables[$param['num']][$mode]['height']+= $h; |
4962 | 5398 | } |
4963 | 5399 | } |
@@ -4976,10 +5412,11 @@ discard block |
||
4976 | 5412 | $x = HTML2PDF::$_tables[$param['num']]['curr_x']; |
4977 | 5413 | $w = HTML2PDF::$_tables[$param['num']]['width']; |
4978 | 5414 | if ($parentWidth>$w) { |
4979 | - if (HTML2PDF::$_tables[$param['num']]['align']=='center') |
|
4980 | - $x = $x + ($parentWidth-$w)*0.5; |
|
4981 | - else if (HTML2PDF::$_tables[$param['num']]['align']=='right') |
|
4982 | - $x = $x + $parentWidth-$w; |
|
5415 | + if (HTML2PDF::$_tables[$param['num']]['align']=='center') { |
|
5416 | + $x = $x + ($parentWidth-$w)*0.5; |
|
5417 | + } else if (HTML2PDF::$_tables[$param['num']]['align']=='right') { |
|
5418 | + $x = $x + $parentWidth-$w; |
|
5419 | + } |
|
4983 | 5420 | |
4984 | 5421 | HTML2PDF::$_tables[$param['num']]['curr_x'] = $x; |
4985 | 5422 | } |
@@ -5002,8 +5439,12 @@ discard block |
||
5002 | 5439 | for ($k=0; $k<count(HTML2PDF::$_tables[$param['num']]['cases']); $k++) { |
5003 | 5440 | |
5004 | 5441 | // if it is a TR of the thead or of the tfoot => skip |
5005 | - if (in_array($k, HTML2PDF::$_tables[$param['num']]['thead']['tr'])) continue; |
|
5006 | - if (in_array($k, HTML2PDF::$_tables[$param['num']]['tfoot']['tr'])) continue; |
|
5442 | + if (in_array($k, HTML2PDF::$_tables[$param['num']]['thead']['tr'])) { |
|
5443 | + continue; |
|
5444 | + } |
|
5445 | + if (in_array($k, HTML2PDF::$_tables[$param['num']]['tfoot']['tr'])) { |
|
5446 | + continue; |
|
5447 | + } |
|
5007 | 5448 | |
5008 | 5449 | // height of the line |
5009 | 5450 | $th = 0; |
@@ -5011,13 +5452,16 @@ discard block |
||
5011 | 5452 | for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$k]); $i++) { |
5012 | 5453 | $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']); |
5013 | 5454 | |
5014 | - if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan']==1) |
|
5015 | - $th = max($th, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']); |
|
5455 | + if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan']==1) { |
|
5456 | + $th = max($th, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']); |
|
5457 | + } |
|
5016 | 5458 | } |
5017 | 5459 | |
5018 | 5460 | // if the row does not fit on the page => new page |
5019 | 5461 | if ($y+$h+$height>$max) { |
5020 | - if ($height==$h0) $height = null; |
|
5462 | + if ($height==$h0) { |
|
5463 | + $height = null; |
|
5464 | + } |
|
5021 | 5465 | HTML2PDF::$_tables[$param['num']]['height'][] = $height; |
5022 | 5466 | $height = $h0; |
5023 | 5467 | $y = $this->_margeTop; |
@@ -5026,7 +5470,9 @@ discard block |
||
5026 | 5470 | } |
5027 | 5471 | |
5028 | 5472 | // if ther is a height at the end, add it |
5029 | - if ($height!=$h0 || $k==0) HTML2PDF::$_tables[$param['num']]['height'][] = $height; |
|
5473 | + if ($height!=$h0 || $k==0) { |
|
5474 | + HTML2PDF::$_tables[$param['num']]['height'][] = $height; |
|
5475 | + } |
|
5030 | 5476 | } else { |
5031 | 5477 | // if we have tfoor, draw it |
5032 | 5478 | if (count(HTML2PDF::$_tables[$param['num']]['tfoot']['code'])) { |
@@ -5051,12 +5497,13 @@ discard block |
||
5051 | 5497 | |
5052 | 5498 | // get the positions of the end of the table |
5053 | 5499 | $x = HTML2PDF::$_tables[$param['num']]['curr_x'] + HTML2PDF::$_tables[$param['num']]['width']; |
5054 | - if (count(HTML2PDF::$_tables[$param['num']]['height'])>1) |
|
5055 | - $y = $this->_margeTop+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1]; |
|
5056 | - else if (count(HTML2PDF::$_tables[$param['num']]['height'])==1) |
|
5057 | - $y = HTML2PDF::$_tables[$param['num']]['curr_y']+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1]; |
|
5058 | - else |
|
5059 | - $y = HTML2PDF::$_tables[$param['num']]['curr_y']; |
|
5500 | + if (count(HTML2PDF::$_tables[$param['num']]['height'])>1) { |
|
5501 | + $y = $this->_margeTop+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1]; |
|
5502 | + } else if (count(HTML2PDF::$_tables[$param['num']]['height'])==1) { |
|
5503 | + $y = HTML2PDF::$_tables[$param['num']]['curr_y']+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1]; |
|
5504 | + } else { |
|
5505 | + $y = HTML2PDF::$_tables[$param['num']]['curr_y']; |
|
5506 | + } |
|
5060 | 5507 | |
5061 | 5508 | $this->_maxX = max($this->_maxX, $x); |
5062 | 5509 | $this->_maxY = max($this->_maxY, $y); |
@@ -5065,7 +5512,9 @@ discard block |
||
5065 | 5512 | |
5066 | 5513 | $this->_loadMargin(); |
5067 | 5514 | |
5068 | - if ($this->_debugActif) $this->_DEBUG_add('Table '.$param['num'], false); |
|
5515 | + if ($this->_debugActif) { |
|
5516 | + $this->_DEBUG_add('Table '.$param['num'], false); |
|
5517 | + } |
|
5069 | 5518 | } |
5070 | 5519 | |
5071 | 5520 | $this->parsingCss->load(); |
@@ -5085,8 +5534,9 @@ discard block |
||
5085 | 5534 | protected function _tag_open_COL($param) |
5086 | 5535 | { |
5087 | 5536 | $span = isset($param['span']) ? $param['span'] : 1; |
5088 | - for ($k=0; $k<$span; $k++) |
|
5089 | - HTML2PDF::$_tables[$param['num']]['cols'][] = $param; |
|
5537 | + for ($k=0; $k<$span; $k++) { |
|
5538 | + HTML2PDF::$_tables[$param['num']]['cols'][] = $param; |
|
5539 | + } |
|
5090 | 5540 | } |
5091 | 5541 | |
5092 | 5542 | /** |
@@ -5112,7 +5562,9 @@ discard block |
||
5112 | 5562 | */ |
5113 | 5563 | protected function _tag_open_TR($param, $other = 'tr') |
5114 | 5564 | { |
5115 | - if ($this->_isForOneLine) return false; |
|
5565 | + if ($this->_isForOneLine) { |
|
5566 | + return false; |
|
5567 | + } |
|
5116 | 5568 | |
5117 | 5569 | $this->_maxH = 0; |
5118 | 5570 | |
@@ -5216,12 +5668,14 @@ discard block |
||
5216 | 5668 | } else { |
5217 | 5669 | // prepare it |
5218 | 5670 | HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1] = array(); |
5219 | - if (!isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']])) |
|
5220 | - HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']] = array(); |
|
5671 | + if (!isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']])) { |
|
5672 | + HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']] = array(); |
|
5673 | + } |
|
5221 | 5674 | |
5222 | 5675 | HTML2PDF::$_tables[$param['num']]['corr_x']=0; |
5223 | - while(isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']])) |
|
5224 | - HTML2PDF::$_tables[$param['num']]['corr_x']++; |
|
5676 | + while(isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']])) { |
|
5677 | + HTML2PDF::$_tables[$param['num']]['corr_x']++; |
|
5678 | + } |
|
5225 | 5679 | } |
5226 | 5680 | |
5227 | 5681 | return true; |
@@ -5236,7 +5690,9 @@ discard block |
||
5236 | 5690 | */ |
5237 | 5691 | protected function _tag_close_TR($param) |
5238 | 5692 | { |
5239 | - if ($this->_isForOneLine) return false; |
|
5693 | + if ($this->_isForOneLine) { |
|
5694 | + return false; |
|
5695 | + } |
|
5240 | 5696 | |
5241 | 5697 | $this->_maxH = 0; |
5242 | 5698 | |
@@ -5274,7 +5730,9 @@ discard block |
||
5274 | 5730 | */ |
5275 | 5731 | protected function _tag_open_TD($param, $other = 'td') |
5276 | 5732 | { |
5277 | - if ($this->_isForOneLine) return false; |
|
5733 | + if ($this->_isForOneLine) { |
|
5734 | + return false; |
|
5735 | + } |
|
5278 | 5736 | |
5279 | 5737 | $this->_maxH = 0; |
5280 | 5738 | |
@@ -5329,10 +5787,11 @@ discard block |
||
5329 | 5787 | if (count($colParam['style']['width'])) { |
5330 | 5788 | $total = $colParam['style']['width'][0]; unset($colParam['style']['width'][0]); |
5331 | 5789 | foreach ($colParam['style']['width'] as $width) { |
5332 | - if (substr($total, -1)=='%' && substr($width, -1)=='%') |
|
5333 | - $total = (str_replace('%', '', $total)+str_replace('%', '', $width)).'%'; |
|
5334 | - else |
|
5335 | - $total = ($this->parsingCss->ConvertToMM($total, $last) + $this->parsingCss->ConvertToMM($width, $last)).'mm'; |
|
5790 | + if (substr($total, -1)=='%' && substr($width, -1)=='%') { |
|
5791 | + $total = (str_replace('%', '', $total)+str_replace('%', '', $width)).'%'; |
|
5792 | + } else { |
|
5793 | + $total = ($this->parsingCss->ConvertToMM($total, $last) + $this->parsingCss->ConvertToMM($width, $last)).'mm'; |
|
5794 | + } |
|
5336 | 5795 | } |
5337 | 5796 | } |
5338 | 5797 | |
@@ -5364,8 +5823,9 @@ discard block |
||
5364 | 5823 | $legacy = array(); |
5365 | 5824 | |
5366 | 5825 | $old = $this->parsingCss->getLastValue('background'); |
5367 | - if ($old && ($old['color'] || $old['image'])) |
|
5368 | - $legacy['background'] = $old; |
|
5826 | + if ($old && ($old['color'] || $old['image'])) { |
|
5827 | + $legacy['background'] = $old; |
|
5828 | + } |
|
5369 | 5829 | |
5370 | 5830 | if (HTML2PDF::$_tables[$param['num']]['border']) { |
5371 | 5831 | $legacy['border'] = array(); |
@@ -5396,7 +5856,9 @@ discard block |
||
5396 | 5856 | } |
5397 | 5857 | |
5398 | 5858 | if (HTML2PDF::$_tables[$param['num']]['td_curr']>0) { |
5399 | - if (!$return) $this->parsingCss->value['width']+= $this->parsingCss->value['border']['l']['width']; |
|
5859 | + if (!$return) { |
|
5860 | + $this->parsingCss->value['width']+= $this->parsingCss->value['border']['l']['width']; |
|
5861 | + } |
|
5400 | 5862 | $this->parsingCss->value['border']['l'] = $this->parsingCss->readBorder('none'); |
5401 | 5863 | } |
5402 | 5864 | } |
@@ -5502,7 +5964,9 @@ discard block |
||
5502 | 5964 | */ |
5503 | 5965 | protected function _tag_close_TD($param) |
5504 | 5966 | { |
5505 | - if ($this->_isForOneLine) return false; |
|
5967 | + if ($this->_isForOneLine) { |
|
5968 | + return false; |
|
5969 | + } |
|
5506 | 5970 | |
5507 | 5971 | $this->_maxH = 0; |
5508 | 5972 | |
@@ -5565,7 +6029,9 @@ discard block |
||
5565 | 6029 | */ |
5566 | 6030 | protected function _tag_open_TH($param) |
5567 | 6031 | { |
5568 | - if ($this->_isForOneLine) return false; |
|
6032 | + if ($this->_isForOneLine) { |
|
6033 | + return false; |
|
6034 | + } |
|
5569 | 6035 | |
5570 | 6036 | $this->parsingCss->save(); |
5571 | 6037 | $this->parsingCss->value['font-bold'] = true; |
@@ -5584,7 +6050,9 @@ discard block |
||
5584 | 6050 | */ |
5585 | 6051 | protected function _tag_close_TH($param) |
5586 | 6052 | { |
5587 | - if ($this->_isForOneLine) return false; |
|
6053 | + if ($this->_isForOneLine) { |
|
6054 | + return false; |
|
6055 | + } |
|
5588 | 6056 | |
5589 | 6057 | $this->_tag_close_TD($param); |
5590 | 6058 | |
@@ -5614,7 +6082,9 @@ discard block |
||
5614 | 6082 | $this->parsingCss->fontSet(); |
5615 | 6083 | |
5616 | 6084 | $res = $this->_drawImage($src, isset($param['sub_li'])); |
5617 | - if (!$res) return $res; |
|
6085 | + if (!$res) { |
|
6086 | + return $res; |
|
6087 | + } |
|
5618 | 6088 | |
5619 | 6089 | $this->parsingCss->load(); |
5620 | 6090 | $this->parsingCss->fontSet(); |
@@ -5655,7 +6125,9 @@ discard block |
||
5655 | 6125 | $this->_lstSelect['size'] = isset($param['size']) ? $param['size'] : 1; |
5656 | 6126 | $this->_lstSelect['options'] = array(); |
5657 | 6127 | |
5658 | - if ($this->_lstSelect['multi'] && $this->_lstSelect['size']<3) $this->_lstSelect['size'] = 3; |
|
6128 | + if ($this->_lstSelect['multi'] && $this->_lstSelect['size']<3) { |
|
6129 | + $this->_lstSelect['size'] = 3; |
|
6130 | + } |
|
5659 | 6131 | |
5660 | 6132 | return true; |
5661 | 6133 | } |
@@ -5708,7 +6180,9 @@ discard block |
||
5708 | 6180 | $f = 1.08*$this->parsingCss->value['font-size']; |
5709 | 6181 | |
5710 | 6182 | // width |
5711 | - $w = $this->parsingCss->value['width']; if (!$w) $w = 50; |
|
6183 | + $w = $this->parsingCss->value['width']; if (!$w) { |
|
6184 | + $w = 50; |
|
6185 | + } |
|
5712 | 6186 | |
5713 | 6187 | // height (automatic) |
5714 | 6188 | $h = ($f*1.07*$this->_lstSelect['size'] + 1); |
@@ -5821,9 +6295,15 @@ discard block |
||
5821 | 6295 | */ |
5822 | 6296 | protected function _tag_open_INPUT($param) |
5823 | 6297 | { |
5824 | - if (!isset($param['name'])) $param['name'] = 'champs_pdf_'.(count($this->_lstField)+1); |
|
5825 | - if (!isset($param['value'])) $param['value'] = ''; |
|
5826 | - if (!isset($param['type'])) $param['type'] = 'text'; |
|
6298 | + if (!isset($param['name'])) { |
|
6299 | + $param['name'] = 'champs_pdf_'.(count($this->_lstField)+1); |
|
6300 | + } |
|
6301 | + if (!isset($param['value'])) { |
|
6302 | + $param['value'] = ''; |
|
6303 | + } |
|
6304 | + if (!isset($param['type'])) { |
|
6305 | + $param['type'] = 'text'; |
|
6306 | + } |
|
5827 | 6307 | |
5828 | 6308 | $param['name'] = strtolower($param['name']); |
5829 | 6309 | $param['type'] = strtolower($param['type']); |
@@ -5857,7 +6337,9 @@ discard block |
||
5857 | 6337 | case 'checkbox': |
5858 | 6338 | $w = 3; |
5859 | 6339 | $h = $w; |
5860 | - if ($h<$f) $y+= ($f-$h)*0.5; |
|
6340 | + if ($h<$f) { |
|
6341 | + $y+= ($f-$h)*0.5; |
|
6342 | + } |
|
5861 | 6343 | $checked = (isset($param['checked']) && $param['checked']=='checked'); |
5862 | 6344 | $this->pdf->CheckBox($name, $w, $checked, $prop, array(), ($param['value'] ? $param['value'] : 'Yes'), $x, $y); |
5863 | 6345 | break; |
@@ -5865,7 +6347,9 @@ discard block |
||
5865 | 6347 | case 'radio': |
5866 | 6348 | $w = 3; |
5867 | 6349 | $h = $w; |
5868 | - if ($h<$f) $y+= ($f-$h)*0.5; |
|
6350 | + if ($h<$f) { |
|
6351 | + $y+= ($f-$h)*0.5; |
|
6352 | + } |
|
5869 | 6353 | $checked = (isset($param['checked']) && $param['checked']=='checked'); |
5870 | 6354 | $this->pdf->RadioButton($name, $w, $prop, array(), ($param['value'] ? $param['value'] : 'On'), $checked, $x, $y); |
5871 | 6355 | break; |
@@ -5878,29 +6362,43 @@ discard block |
||
5878 | 6362 | break; |
5879 | 6363 | |
5880 | 6364 | case 'text': |
5881 | - $w = $this->parsingCss->value['width']; if (!$w) $w = 40; |
|
6365 | + $w = $this->parsingCss->value['width']; if (!$w) { |
|
6366 | + $w = 40; |
|
6367 | + } |
|
5882 | 6368 | $h = $f*1.3; |
5883 | 6369 | $prop['value'] = $param['value']; |
5884 | 6370 | $this->pdf->TextField($name, $w, $h, $prop, array(), $x, $y); |
5885 | 6371 | break; |
5886 | 6372 | |
5887 | 6373 | case 'submit': |
5888 | - $w = $this->parsingCss->value['width']; if (!$w) $w = 40; |
|
5889 | - $h = $this->parsingCss->value['height']; if (!$h) $h = $f*1.3; |
|
6374 | + $w = $this->parsingCss->value['width']; if (!$w) { |
|
6375 | + $w = 40; |
|
6376 | + } |
|
6377 | + $h = $this->parsingCss->value['height']; if (!$h) { |
|
6378 | + $h = $f*1.3; |
|
6379 | + } |
|
5890 | 6380 | $action = array('S'=>'SubmitForm', 'F'=>$this->_isInForm, 'Flags'=>array('ExportFormat')); |
5891 | 6381 | $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y); |
5892 | 6382 | break; |
5893 | 6383 | |
5894 | 6384 | case 'reset': |
5895 | - $w = $this->parsingCss->value['width']; if (!$w) $w = 40; |
|
5896 | - $h = $this->parsingCss->value['height']; if (!$h) $h = $f*1.3; |
|
6385 | + $w = $this->parsingCss->value['width']; if (!$w) { |
|
6386 | + $w = 40; |
|
6387 | + } |
|
6388 | + $h = $this->parsingCss->value['height']; if (!$h) { |
|
6389 | + $h = $f*1.3; |
|
6390 | + } |
|
5897 | 6391 | $action = array('S'=>'ResetForm'); |
5898 | 6392 | $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y); |
5899 | 6393 | break; |
5900 | 6394 | |
5901 | 6395 | case 'button': |
5902 | - $w = $this->parsingCss->value['width']; if (!$w) $w = 40; |
|
5903 | - $h = $this->parsingCss->value['height']; if (!$h) $h = $f*1.3; |
|
6396 | + $w = $this->parsingCss->value['width']; if (!$w) { |
|
6397 | + $w = 40; |
|
6398 | + } |
|
6399 | + $h = $this->parsingCss->value['height']; if (!$h) { |
|
6400 | + $h = $f*1.3; |
|
6401 | + } |
|
5904 | 6402 | $action = isset($param['onclick']) ? $param['onclick'] : ''; |
5905 | 6403 | $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y); |
5906 | 6404 | break; |
@@ -5932,15 +6430,21 @@ discard block |
||
5932 | 6430 | */ |
5933 | 6431 | protected function _tag_open_DRAW($param) |
5934 | 6432 | { |
5935 | - if ($this->_isForOneLine) return false; |
|
5936 | - if ($this->_debugActif) $this->_DEBUG_add('DRAW', true); |
|
6433 | + if ($this->_isForOneLine) { |
|
6434 | + return false; |
|
6435 | + } |
|
6436 | + if ($this->_debugActif) { |
|
6437 | + $this->_DEBUG_add('DRAW', true); |
|
6438 | + } |
|
5937 | 6439 | |
5938 | 6440 | $this->parsingCss->save(); |
5939 | 6441 | $this->parsingCss->analyse('draw', $param); |
5940 | 6442 | $this->parsingCss->fontSet(); |
5941 | 6443 | |
5942 | 6444 | $alignObject = null; |
5943 | - if ($this->parsingCss->value['margin-auto']) $alignObject = 'center'; |
|
6445 | + if ($this->parsingCss->value['margin-auto']) { |
|
6446 | + $alignObject = 'center'; |
|
6447 | + } |
|
5944 | 6448 | |
5945 | 6449 | $overW = $this->parsingCss->value['width']; |
5946 | 6450 | $overH = $this->parsingCss->value['height']; |
@@ -5955,22 +6459,27 @@ discard block |
||
5955 | 6459 | if ( |
5956 | 6460 | $w < ($this->pdf->getW() - $this->pdf->getlMargin()-$this->pdf->getrMargin()) && |
5957 | 6461 | $this->pdf->getX() + $w>=($this->pdf->getW() - $this->pdf->getrMargin()) |
5958 | - ) |
|
5959 | - $this->_tag_open_BR(array()); |
|
6462 | + ) { |
|
6463 | + $this->_tag_open_BR(array()); |
|
6464 | + } |
|
5960 | 6465 | |
5961 | 6466 | if ( |
5962 | 6467 | ($h < ($this->pdf->getH() - $this->pdf->gettMargin()-$this->pdf->getbMargin())) && |
5963 | 6468 | ($this->pdf->getY() + $h>=($this->pdf->getH() - $this->pdf->getbMargin())) && |
5964 | 6469 | !$this->_isInOverflow |
5965 | - ) |
|
5966 | - $this->_setNewPage(); |
|
6470 | + ) { |
|
6471 | + $this->_setNewPage(); |
|
6472 | + } |
|
5967 | 6473 | |
5968 | 6474 | $old = $this->parsingCss->getOldValues(); |
5969 | 6475 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
5970 | 6476 | |
5971 | 6477 | if ($parentWidth>$w) { |
5972 | - if ($alignObject=='center') $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
5973 | - else if ($alignObject=='right') $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
6478 | + if ($alignObject=='center') { |
|
6479 | + $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
6480 | + } else if ($alignObject=='right') { |
|
6481 | + $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
6482 | + } |
|
5974 | 6483 | } |
5975 | 6484 | |
5976 | 6485 | $this->parsingCss->setPosition(); |
@@ -5979,8 +6488,11 @@ discard block |
||
5979 | 6488 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
5980 | 6489 | |
5981 | 6490 | if ($parentWidth>$w) { |
5982 | - if ($alignObject=='center') $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
5983 | - else if ($alignObject=='right') $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
6491 | + if ($alignObject=='center') { |
|
6492 | + $this->pdf->setX($this->pdf->getX() + ($parentWidth-$w)*0.5); |
|
6493 | + } else if ($alignObject=='right') { |
|
6494 | + $this->pdf->setX($this->pdf->getX() + $parentWidth-$w); |
|
6495 | + } |
|
5984 | 6496 | } |
5985 | 6497 | |
5986 | 6498 | $this->parsingCss->setPosition(); |
@@ -6057,7 +6569,9 @@ discard block |
||
6057 | 6569 | */ |
6058 | 6570 | protected function _tag_close_DRAW($param) |
6059 | 6571 | { |
6060 | - if ($this->_isForOneLine) return false; |
|
6572 | + if ($this->_isForOneLine) { |
|
6573 | + return false; |
|
6574 | + } |
|
6061 | 6575 | |
6062 | 6576 | $this->pdf->SetAlpha(1.); |
6063 | 6577 | $this->pdf->undoTransform(); |
@@ -6098,8 +6612,12 @@ discard block |
||
6098 | 6612 | $this->parsingCss->fontSet(); |
6099 | 6613 | $this->_loadMargin(); |
6100 | 6614 | |
6101 | - if ($block) $this->_tag_open_BR(array()); |
|
6102 | - if ($this->_debugActif) $this->_DEBUG_add('DRAW', false); |
|
6615 | + if ($block) { |
|
6616 | + $this->_tag_open_BR(array()); |
|
6617 | + } |
|
6618 | + if ($this->_debugActif) { |
|
6619 | + $this->_DEBUG_add('DRAW', false); |
|
6620 | + } |
|
6103 | 6621 | |
6104 | 6622 | $this->_isInDraw = null; |
6105 | 6623 | |
@@ -6115,7 +6633,9 @@ discard block |
||
6115 | 6633 | */ |
6116 | 6634 | protected function _tag_open_LINE($param) |
6117 | 6635 | { |
6118 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'LINE'); |
|
6636 | + if (!$this->_isInDraw) { |
|
6637 | + throw new HTML2PDF_exception(8, 'LINE'); |
|
6638 | + } |
|
6119 | 6639 | |
6120 | 6640 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6121 | 6641 | $this->parsingCss->save(); |
@@ -6142,7 +6662,9 @@ discard block |
||
6142 | 6662 | */ |
6143 | 6663 | protected function _tag_open_RECT($param) |
6144 | 6664 | { |
6145 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'RECT'); |
|
6665 | + if (!$this->_isInDraw) { |
|
6666 | + throw new HTML2PDF_exception(8, 'RECT'); |
|
6667 | + } |
|
6146 | 6668 | |
6147 | 6669 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6148 | 6670 | $this->parsingCss->save(); |
@@ -6169,7 +6691,9 @@ discard block |
||
6169 | 6691 | */ |
6170 | 6692 | protected function _tag_open_CIRCLE($param) |
6171 | 6693 | { |
6172 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'CIRCLE'); |
|
6694 | + if (!$this->_isInDraw) { |
|
6695 | + throw new HTML2PDF_exception(8, 'CIRCLE'); |
|
6696 | + } |
|
6173 | 6697 | |
6174 | 6698 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6175 | 6699 | $this->parsingCss->save(); |
@@ -6194,7 +6718,9 @@ discard block |
||
6194 | 6718 | */ |
6195 | 6719 | protected function _tag_open_ELLIPSE($param) |
6196 | 6720 | { |
6197 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'ELLIPSE'); |
|
6721 | + if (!$this->_isInDraw) { |
|
6722 | + throw new HTML2PDF_exception(8, 'ELLIPSE'); |
|
6723 | + } |
|
6198 | 6724 | |
6199 | 6725 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6200 | 6726 | $this->parsingCss->save(); |
@@ -6221,7 +6747,9 @@ discard block |
||
6221 | 6747 | */ |
6222 | 6748 | protected function _tag_open_POLYLINE($param) |
6223 | 6749 | { |
6224 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6750 | + if (!$this->_isInDraw) { |
|
6751 | + throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6752 | + } |
|
6225 | 6753 | |
6226 | 6754 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6227 | 6755 | $this->parsingCss->save(); |
@@ -6237,7 +6765,9 @@ discard block |
||
6237 | 6765 | $path = explode(' ', $path); |
6238 | 6766 | foreach ($path as $k => $v) { |
6239 | 6767 | $path[$k] = trim($v); |
6240 | - if ($path[$k]==='') unset($path[$k]); |
|
6768 | + if ($path[$k]==='') { |
|
6769 | + unset($path[$k]); |
|
6770 | + } |
|
6241 | 6771 | } |
6242 | 6772 | $path = array_values($path); |
6243 | 6773 | |
@@ -6267,7 +6797,9 @@ discard block |
||
6267 | 6797 | */ |
6268 | 6798 | protected function _tag_open_POLYGON($param) |
6269 | 6799 | { |
6270 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6800 | + if (!$this->_isInDraw) { |
|
6801 | + throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6802 | + } |
|
6271 | 6803 | |
6272 | 6804 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6273 | 6805 | $this->parsingCss->save(); |
@@ -6283,7 +6815,9 @@ discard block |
||
6283 | 6815 | $path = explode(' ', $path); |
6284 | 6816 | foreach ($path as $k => $v) { |
6285 | 6817 | $path[$k] = trim($v); |
6286 | - if ($path[$k]==='') unset($path[$k]); |
|
6818 | + if ($path[$k]==='') { |
|
6819 | + unset($path[$k]); |
|
6820 | + } |
|
6287 | 6821 | } |
6288 | 6822 | $path = array_values($path); |
6289 | 6823 | |
@@ -6314,7 +6848,9 @@ discard block |
||
6314 | 6848 | */ |
6315 | 6849 | protected function _tag_open_PATH($param) |
6316 | 6850 | { |
6317 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'PATH'); |
|
6851 | + if (!$this->_isInDraw) { |
|
6852 | + throw new HTML2PDF_exception(8, 'PATH'); |
|
6853 | + } |
|
6318 | 6854 | |
6319 | 6855 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6320 | 6856 | $this->parsingCss->save(); |
@@ -6334,7 +6870,9 @@ discard block |
||
6334 | 6870 | $path = explode(' ', $path); |
6335 | 6871 | foreach ($path as $k => $v) { |
6336 | 6872 | $path[$k] = trim($v); |
6337 | - if ($path[$k]==='') unset($path[$k]); |
|
6873 | + if ($path[$k]==='') { |
|
6874 | + unset($path[$k]); |
|
6875 | + } |
|
6338 | 6876 | } |
6339 | 6877 | $path = array_values($path); |
6340 | 6878 | |
@@ -6443,7 +6981,9 @@ discard block |
||
6443 | 6981 | */ |
6444 | 6982 | protected function _tag_open_G($param) |
6445 | 6983 | { |
6446 | - if (!$this->_isInDraw) throw new HTML2PDF_exception(8, 'G'); |
|
6984 | + if (!$this->_isInDraw) { |
|
6985 | + throw new HTML2PDF_exception(8, 'G'); |
|
6986 | + } |
|
6447 | 6987 | |
6448 | 6988 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6449 | 6989 | $this->parsingCss->save(); |