@@ -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 |
@@ -137,10 +138,11 @@ discard block |
||
137 | 138 | foreach ($form_fileds as $fieldkey => $fieldvalue) { |
138 | 139 | $form_contents .= '<li class="col-md-12">'; |
139 | 140 | if ($fieldvalue[1] == 'HIDDEN') { |
140 | - if (isset($this->CI->input->post)) |
|
141 | - $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
142 | - else |
|
143 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
141 | + if (isset($this->CI->input->post)) { |
|
142 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
143 | + } else { |
|
144 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
145 | + } |
|
144 | 146 | $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
145 | 147 | } else { |
146 | 148 | $validation_arr = array(); |
@@ -148,8 +150,7 @@ discard block |
||
148 | 150 | if ( ! empty($fieldvalue[3])) { |
149 | 151 | $validation_arr = explode("|", $fieldvalue[3]); |
150 | 152 | } |
151 | - } |
|
152 | - elseif ($fieldvalue[2] == 'SELECT') { |
|
153 | + } elseif ($fieldvalue[2] == 'SELECT') { |
|
153 | 154 | |
154 | 155 | if (is_array($fieldvalue[4])) { |
155 | 156 | $validation_arr = explode("|", $fieldvalue[4]['rules']); |
@@ -199,16 +200,16 @@ discard block |
||
199 | 200 | |
200 | 201 | if(isset($fieldvalue[1]['name'])){ |
201 | 202 | $fieldvalue_pass=$fieldvalue[1]['name']; |
202 | - }else{ |
|
203 | + } else{ |
|
203 | 204 | $fieldvalue_pass=$fieldvalue[1]; |
204 | 205 | } |
205 | 206 | |
206 | 207 | $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
207 | - }else{ |
|
208 | + } else{ |
|
208 | 209 | |
209 | 210 | if(isset($fieldvalue[1]['name'])){ |
210 | 211 | $fieldvalue_pass=$fieldvalue[1]['name']; |
211 | - }else{ |
|
212 | + } else{ |
|
212 | 213 | $fieldvalue_pass=$fieldvalue[1]; |
213 | 214 | } |
214 | 215 | |
@@ -244,10 +245,11 @@ discard block |
||
244 | 245 | /* For multi select code */ |
245 | 246 | $str = $fieldvalue[7] . "," . $fieldvalue[8]; |
246 | 247 | |
247 | - if (isset($this->CI->input->post)) |
|
248 | - $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
249 | - else |
|
250 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
248 | + if (isset($this->CI->input->post)) { |
|
249 | + $fieldvalue['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
250 | + } else { |
|
251 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
253 | 255 | if ($fieldset_key === 'System Configuration Information') { |
@@ -264,9 +266,9 @@ discard block |
||
264 | 266 | } else if ($fieldvalue[1] == 'INPUT') { |
265 | 267 | |
266 | 268 | |
267 | - if (isset($this->CI->input->post)) |
|
268 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? $fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
269 | - else{ |
|
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{ |
|
270 | 272 | $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : ''):(isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] :''); |
271 | 273 | } |
272 | 274 | $form_contents.= form_input($fieldvalue[2], 'readonly'); |
@@ -282,11 +284,11 @@ discard block |
||
282 | 284 | * Image upload from invoice configuration code. |
283 | 285 | */ |
284 | 286 | else if ($fieldvalue[1] == 'IMAGE') { |
285 | - if (isset($this->CI->input->post)) |
|
286 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
287 | - |
|
288 | - else |
|
289 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
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 | + } else { |
|
290 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
291 | + } |
|
290 | 292 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
291 | 293 | $form_contents.= form_image($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
292 | 294 | $form_contents.=@$fieldvalue[6]; |
@@ -294,13 +296,12 @@ discard block |
||
294 | 296 | $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>'; |
295 | 297 | $form_contents.= '<span class="popup_error error no-padding" id="'.$fieldvalue[2]['name'].'_error"> |
296 | 298 | </span></div>'; |
297 | - } |
|
298 | - else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
299 | - if (isset($this->CI->input->post)) |
|
300 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
301 | - |
|
302 | - else |
|
303 | - $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
299 | + } else if ($fieldvalue[1] == 'DEL_BUTTON') { |
|
300 | + if (isset($this->CI->input->post)) { |
|
301 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
302 | + } else { |
|
303 | + $fieldvalue[2]['value'] = ($values) ? @$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
304 | + } |
|
304 | 305 | $fieldvalue[2]['style'] = isset($fieldvalue[2]['style']) ? $fieldvalue[2]['style'] : ""; |
305 | 306 | $form_contents.= form_img_delete($fieldvalue[2], 'readonly',$fieldvalue[2]['style']); |
306 | 307 | $form_contents.=@$fieldvalue[6]; |
@@ -311,10 +312,11 @@ discard block |
||
311 | 312 | } |
312 | 313 | /**********************************************************************************/ |
313 | 314 | else if ($fieldvalue[1] == 'PASSWORD') { |
314 | - if (isset($this->CI->input->post)) |
|
315 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
316 | - else |
|
317 | - $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
315 | + if (isset($this->CI->input->post)) { |
|
316 | + $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
317 | + } else { |
|
318 | + $fieldvalue[2]['value'] = ($values) ?@$values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
319 | + } |
|
318 | 320 | $form_contents.= form_password($fieldvalue[2]); |
319 | 321 | $this->CI->form_validation->set_rules($fieldvalue[2]['name'], $fieldvalue[0], $fieldvalue[3]); |
320 | 322 | $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>'; |
@@ -323,12 +325,12 @@ discard block |
||
323 | 325 | } else if ($fieldvalue[2] == 'CHECKBOX') { |
324 | 326 | $OptionArray = array(); |
325 | 327 | |
326 | - if(isset($fieldvalue[7]) && $fieldvalue[7] != '') |
|
327 | - $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
328 | + if(isset($fieldvalue[7]) && $fieldvalue[7] != '') { |
|
329 | + $OptionArray = call_user_func_array(array($this->CI->common, $fieldvalue[7]), array($fieldvalue[6])); |
|
330 | + } |
|
328 | 331 | if (isset($this->CI->input->post)){ |
329 | 332 | $fieldvalue[3]['value'] = (!$this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[3]['value'] : $this->CI->input->post($fieldvalue[1]); |
330 | - } |
|
331 | - else |
|
333 | + } else |
|
332 | 334 | { |
333 | 335 | $fieldvalue[3]['value'] = ($values) ? (isset($values[$fieldvalue[1]]) && $values[$fieldvalue[1]] ? 1: 0) : @$fieldvalue[3]['value']; |
334 | 336 | } |
@@ -340,18 +342,18 @@ discard block |
||
340 | 342 | if(isset($fieldvalue[3]['table_name']) && $fieldvalue[3]['table_name'] != ""){ |
341 | 343 | |
342 | 344 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked , $OptionArray); |
343 | - }else{ |
|
345 | + } else{ |
|
344 | 346 | $form_contents.= form_checkbox($fieldvalue[1], $fieldvalue[3]['value'],$checked ,$OptionArray); |
345 | 347 | } |
346 | 348 | } else if ($fieldvalue[1] == 'TEXTAREA') { |
347 | 349 | |
348 | - if (isset($this->CI->input->post)) |
|
349 | - $fieldvalue[2]['value'] = (!$this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
350 | - else |
|
351 | - $fieldvalue[2]['value'] = ($values) ? $values[$fieldvalue[2]['name']] : @$fieldvalue[2]['value']; |
|
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']; |
|
354 | + } |
|
352 | 355 | $form_contents.= form_textarea($fieldvalue[2]); |
353 | - } |
|
354 | - else if ($fieldvalue[2] == 'RADIO') { |
|
356 | + } else if ($fieldvalue[2] == 'RADIO') { |
|
355 | 357 | |
356 | 358 | $form_contents.= form_radio($fieldvalue[1], $fieldvalue[3]['value'], $fieldvalue[3]['checked']); |
357 | 359 | } |
@@ -581,8 +583,9 @@ discard block |
||
581 | 583 | $json_data["json_paging"]['total'] = $config['total_rows']; |
582 | 584 | $perpage = $config['per_page']; |
583 | 585 | $start = ($page_no - 1) * $perpage; |
584 | - if ($start < 0) |
|
585 | - $start = 0; |
|
586 | + if ($start < 0) { |
|
587 | + $start = 0; |
|
588 | + } |
|
586 | 589 | $json_data["paging"]['start'] = $start; |
587 | 590 | $json_data["paging"]['page_no'] = $perpage; |
588 | 591 | return $json_data; |
@@ -611,7 +614,7 @@ discard block |
||
611 | 614 | if($field_arr[2]=="status"){ |
612 | 615 | $row['id'] = $row_id; |
613 | 616 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
614 | - }else{ |
|
617 | + } else{ |
|
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[$field_arr[2]])); |
616 | 619 | } |
617 | 620 | |
@@ -636,13 +639,13 @@ discard block |
||
636 | 639 | $fieldstr = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
637 | 640 | if($acctype != ''){ |
638 | 641 | $jsn_tmp[$field_key] = $fieldstr."<br/>".$acctype; |
639 | - }else{ |
|
642 | + } else{ |
|
640 | 643 | $jsn_tmp[$field_key] = $fieldstr; |
641 | 644 | } |
642 | 645 | |
643 | 646 | |
644 | 647 | /*********************************/ |
645 | - }else { |
|
648 | + } else { |
|
646 | 649 | $jsn_tmp[$field_key] = $row[$field_arr[2]]; |
647 | 650 | } |
648 | 651 | } else { |
@@ -676,15 +679,13 @@ discard block |
||
676 | 679 | */ |
677 | 680 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row_id); |
678 | 681 | /****************************************************************************/ |
679 | - } |
|
680 | - elseif($field_arr[0] == gettext("Profile Action")) |
|
682 | + } elseif($field_arr[0] == gettext("Profile Action")) |
|
681 | 683 | { |
682 | 684 | 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)){ |
683 | 685 | } |
684 | 686 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
685 | 687 | |
686 | - } |
|
687 | - else { |
|
688 | + } else { |
|
688 | 689 | $className = (isset($field_arr['9']) && $field_arr['9'] != '')?$field_arr['9']:"chkRefNos"; |
689 | 690 | $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>'; } |
690 | 691 | } |
@@ -713,7 +714,7 @@ discard block |
||
713 | 714 | if($field_arr[2]=="status"){ |
714 | 715 | $row['id'] = $row_id; |
715 | 716 | $jsn_tmp[$field_key] = call_user_func_array(array($this->CI->common, $field_arr[5]), array($field_arr[3], $field_arr[4], $row)); |
716 | - }else{ |
|
717 | + } else{ |
|
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[$field_arr[2]])); |
718 | 719 | } |
719 | 720 | /** |
@@ -731,14 +732,13 @@ discard block |
||
731 | 732 | } |
732 | 733 | $jsn_tmp[$field_key] = $this->CI->common->build_custome_edit_button($ActionArr[5]->EDIT,$row[$field_arr[2]],$row["id"]); |
733 | 734 | /*******************************/ |
734 | - }else { |
|
735 | + } else { |
|
735 | 736 | $jsn_tmp[$field_key] = isset($row[$field_arr[2]]) ? $row[$field_arr[2]] : ""; |
736 | 737 | } |
737 | 738 | } else { |
738 | 739 | if ($field_arr[0] == "Action") { |
739 | 740 | $jsn_tmp[$field_key] = $this->CI->common->get_action_buttons($field_arr[5], $row["id"]); |
740 | - } |
|
741 | - else { |
|
741 | + } else { |
|
742 | 742 | $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>'; |
743 | 743 | } |
744 | 744 | } |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if ( ! defined('BASEPATH')) |
|
25 | +if ( ! defined('BASEPATH')) { |
|
26 | 26 | exit('No direct script access allowed'); |
27 | +} |
|
27 | 28 | |
28 | 29 | /** |
29 | 30 | * Dynamically build forms for display |
@@ -113,8 +114,9 @@ discard block |
||
113 | 114 | $flag = false; |
114 | 115 | $uname = $this->random_string($length); |
115 | 116 | $uname = strtolower($uname); |
116 | - if (isset($default)) |
|
117 | - $uname = $default.$uname; |
|
117 | + if (isset($default)) { |
|
118 | + $uname = $default.$uname; |
|
119 | + } |
|
118 | 120 | if ( ! in_array($uname, $number)) { |
119 | 121 | $where = array($field => $uname); |
120 | 122 | $acc_result = $this->CI->db_model->getSelect('Count(id) as count', $tablename, $where); |
@@ -243,8 +245,7 @@ discard block |
||
243 | 245 | $accountinfo = $this->CI->session->userdata('accountinfo'); |
244 | 246 | if ($did_info['accountid'] == 0 && $did_info['parent_id'] == 0) { |
245 | 247 | $status = 'Not in use'; |
246 | - } |
|
247 | - elseif ($accountinfo['type'] != 1) { |
|
248 | + } elseif ($accountinfo['type'] != 1) { |
|
248 | 249 | if ($did_info['accountid'] == 0 && $did_info['parent_id'] > 0) { |
249 | 250 | $status = 'Purchase by Reseller'; |
250 | 251 | } |
@@ -274,8 +275,7 @@ discard block |
||
274 | 275 | $did_info = (array)$this->CI->db->get('dids')->first_row(); |
275 | 276 | if ($did_info['accountid'] > 0 && $did_info['parent_id'] == $accountinfo['id']) { |
276 | 277 | $flag_status = "<a href='../did_list_release/".$did_info['id']."' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(C)<span></a>"; |
277 | - } |
|
278 | - else if ($accountinfo['type'] != 1 && $did_info['parent_id'] != $accountinfo['id']) { |
|
278 | + } else if ($accountinfo['type'] != 1 && $did_info['parent_id'] != $accountinfo['id']) { |
|
279 | 279 | $flag_status = "<a href='../did_list_release/".$did_info['id']."' title='Release' onClick='return get_reliase_msg();'><span class=' label label-sm label-inverse_blue arrowed_blue-in' title='release'>Release(R)</span></a>"; |
280 | 280 | } else { |
281 | 281 | $reseller_id = $accountinfo['type'] != 1 ? 0 : $accountinfo['id']; |
@@ -870,9 +870,9 @@ discard block |
||
870 | 870 | $rel = (isset($button_params->layout) && $button_params->layout != '')?"facebox_".$button_params->layout:"facebox"; |
871 | 871 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" rel="'.$rel.'" title="Edit" ="small"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
872 | 872 | |
873 | - }else if(strpos($link,'customer_edit') !== false){ |
|
873 | + } else if(strpos($link,'customer_edit') !== false){ |
|
874 | 874 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
875 | - }else { |
|
875 | + } else { |
|
876 | 876 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Edit"><i class="fa fa-pencil-square-o fa-fw"></i></a> '; |
877 | 877 | } |
878 | 878 | } |
@@ -913,14 +913,18 @@ discard block |
||
913 | 913 | $data= explode("/",$url); |
914 | 914 | $link = base_url() . $url . "" . $linkid; |
915 | 915 | foreach($data as $key=>$value){ |
916 | - if($value == 'price_delete') |
|
917 | - $flag = '1'; |
|
918 | - if($value == 'trunk_remove') |
|
919 | - $flag='2'; |
|
920 | - if($value == 'customer_delete' ||$value =='provider_delete') |
|
921 | - $flag='3'; |
|
922 | - if($value == 'reseller_delete') |
|
923 | - $flag='4'; |
|
916 | + if($value == 'price_delete') { |
|
917 | + $flag = '1'; |
|
918 | + } |
|
919 | + if($value == 'trunk_remove') { |
|
920 | + $flag='2'; |
|
921 | + } |
|
922 | + if($value == 'customer_delete' ||$value =='provider_delete') { |
|
923 | + $flag='3'; |
|
924 | + } |
|
925 | + if($value == 'reseller_delete') { |
|
926 | + $flag='4'; |
|
927 | + } |
|
924 | 928 | } |
925 | 929 | if($flag=='1'){ |
926 | 930 | $where=array('pricelist_id'=>$linkid,'deleted !=' =>'1'); |
@@ -930,8 +934,7 @@ discard block |
||
930 | 934 | if($rategroup_cnt > 0 || $customer_cnt > 0 ){ |
931 | 935 | |
932 | 936 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$rategroup_cnt.','.$customer_cnt.','.$linkid.',1);"><i class="fa fa-trash fa-fw"></i></a>'; |
933 | - } |
|
934 | - else{ |
|
937 | + } else{ |
|
935 | 938 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
936 | 939 | } |
937 | 940 | } |
@@ -940,8 +943,7 @@ discard block |
||
940 | 943 | $trunk_cnt=$this->get_field_count('id','outbound_routes',$where); |
941 | 944 | if($trunk_cnt > 0){ |
942 | 945 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_message('.$trunk_cnt.',null,'.$linkid.',2);"><i class="fa fa-trash fa-fw"></i></a>'; |
943 | - } |
|
944 | - else{ |
|
946 | + } else{ |
|
945 | 947 | return '<a href="' . $link . '" class="btn btn-royelblue btn-sm" title="Delete" onClick="return get_alert_msg();"><i class="fa fa-trash fa-fw"></i></a>'; |
946 | 948 | } |
947 | 949 | } |
@@ -2045,7 +2047,7 @@ discard block |
||
2045 | 2047 | |
2046 | 2048 | $ACCOUNT_DESCRIPTION .= '<td style="width:20%;font-size: 12px;color:#525252;font-family:arial; line-height: 22px;text-align:right;">'.$this->currency_decimal($this->CI->common_model->calculate_currency($charge_res['debit'])).'</td>'; |
2047 | 2049 | $ACCOUNT_DESCRIPTION .= '</tr>'; |
2048 | - }else{ |
|
2050 | + } else{ |
|
2049 | 2051 | $cdrs_data = $this->CI->db_model->getSelect("sum(billseconds) as billseconds,count(*) as count", "cdrs", array("accountid" => $charge_res['accountid'],"calltype" => $charge_res['item_type'])); |
2050 | 2052 | $cdrs_result = $cdrs_data->result_array(); |
2051 | 2053 | if($cdrs_result[0]['count'] > 0 ){ |
@@ -2185,7 +2187,7 @@ discard block |
||
2185 | 2187 | $download_path = $invoicedata['invoice_prefix'].$invoicedata['invoiceid'].".pdf"; |
2186 | 2188 | |
2187 | 2189 | $this->CI->html2pdf->Output($download_path,"D"); |
2188 | - }else{ |
|
2190 | + } else{ |
|
2189 | 2191 | $current_dir = getcwd()."/invoices/"; |
2190 | 2192 | $dir_name = $accountdata["id"]; |
2191 | 2193 | if(!is_dir($current_dir.$dir_name)){ |
@@ -2208,16 +2210,17 @@ discard block |
||
2208 | 2210 | $select = "concat($cnt_str) as $select_params[2] "; |
2209 | 2211 | $drp_array = $this->CI->db_model->getSelect($select, $table, $where); |
2210 | 2212 | $drp_array = $drp_array->result(); |
2211 | - if (isset($drp_array[0])) |
|
2212 | - return $drp_array[0]->$select_params[2]; |
|
2213 | - else |
|
2214 | - return 'Admin'; |
|
2213 | + if (isset($drp_array[0])) { |
|
2214 | + return $drp_array[0]->$select_params[2]; |
|
2215 | + } else { |
|
2216 | + return 'Admin'; |
|
2217 | + } |
|
2215 | 2218 | } |
2216 | 2219 | |
2217 | 2220 | function get_subreseller_info($parent_id){ |
2218 | 2221 | if(!empty($parent_id)){ |
2219 | 2222 | $str=$parent_id.","; |
2220 | - }else{ |
|
2223 | + } else{ |
|
2221 | 2224 | $str=null; |
2222 | 2225 | } |
2223 | 2226 | $query = "select id from accounts where reseller_id = '$parent_id' AND deleted =0 AND type=1"; |
@@ -2235,7 +2238,7 @@ discard block |
||
2235 | 2238 | function get_parent_info($child_id,$parent_id){ |
2236 | 2239 | if(!empty($child_id)){ |
2237 | 2240 | $str=$child_id.","; |
2238 | - }else{ |
|
2241 | + } else{ |
|
2239 | 2242 | $str=null; |
2240 | 2243 | } |
2241 | 2244 | if($child_id > 0){ |
@@ -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 |
@@ -121,9 +122,9 @@ discard block |
||
121 | 122 | } |
122 | 123 | |
123 | 124 | function build_template($template_type,$detail,$detail_type='') { |
124 | - if(!is_array($template_type)) |
|
125 | - $this->get_template($template_type); |
|
126 | - else{ |
|
125 | + if(!is_array($template_type)) { |
|
126 | + $this->get_template($template_type); |
|
127 | + } else{ |
|
127 | 128 | $this->message=$template_type['message']; |
128 | 129 | $this->subject=$template_type['subject']; |
129 | 130 | $template_type=''; |
@@ -226,7 +227,9 @@ discard block |
||
226 | 227 | } |
227 | 228 | function get_smtp_details() |
228 | 229 | { |
229 | - if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='')exit; |
|
230 | + if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='') { |
|
231 | + exit; |
|
232 | + } |
|
230 | 233 | $config['protocol'] = "smtp"; |
231 | 234 | $config['smtp_host'] = $this->smtp_host; |
232 | 235 | $config['smtp_port'] = $this->smtp_port; |
@@ -243,14 +246,15 @@ discard block |
||
243 | 246 | if(!$this->email){ |
244 | 247 | if(!$resend){ |
245 | 248 | $this->build_template($template_type,$details,$detail_type); |
246 | - }else{ |
|
249 | + } else{ |
|
247 | 250 | $this->set_email_paramenters($details); |
248 | 251 | } |
249 | 252 | |
250 | - if(!$brodcast) |
|
251 | - $history_id=$this->mail_history($attachment); |
|
252 | - else |
|
253 | - $history_id=$details['history_id']; |
|
253 | + if(!$brodcast) { |
|
254 | + $history_id=$this->mail_history($attachment); |
|
255 | + } else { |
|
256 | + $history_id=$details['history_id']; |
|
257 | + } |
|
254 | 258 | if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
255 | 259 | if(!$this->smtp){ |
256 | 260 | $this->get_smtp_details(); |
@@ -287,14 +291,15 @@ discard block |
||
287 | 291 | |
288 | 292 | if(!$resend){ |
289 | 293 | $this->build_template($template_type,$details,$detail_type); |
290 | - }else{ |
|
294 | + } else{ |
|
291 | 295 | $this->set_email_paramenters($details); |
292 | 296 | } |
293 | 297 | |
294 | - if(!$brodcast) |
|
295 | - $history_id=$this->mail_history($attachment); |
|
296 | - else |
|
297 | - $history_id=$details['history_id']; |
|
298 | + if(!$brodcast) { |
|
299 | + $history_id=$this->mail_history($attachment); |
|
300 | + } else { |
|
301 | + $history_id=$details['history_id']; |
|
302 | + } |
|
298 | 303 | if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
299 | 304 | if(!$this->smtp){ |
300 | 305 | $this->get_smtp_details(); |
@@ -549,8 +549,12 @@ discard block |
||
549 | 549 | public function setRotation($angle, $xC = null, $yC = null) |
550 | 550 | { |
551 | 551 | // if no center, rotate around the current posiition |
552 | - if ($xC === null) $xC = $this->x; |
|
553 | - if ($yC === null) $yC = $this->y; |
|
552 | + if ($xC === null) { |
|
553 | + $xC = $this->x; |
|
554 | + } |
|
555 | + if ($yC === null) { |
|
556 | + $yC = $this->y; |
|
557 | + } |
|
554 | 558 | |
555 | 559 | // prepare the coordinate |
556 | 560 | $yC = ($this->h - $yC) * $this->k; |
@@ -592,8 +596,9 @@ discard block |
||
592 | 596 | */ |
593 | 597 | public function SetY($y, $resetx = true, $rtloff = false) |
594 | 598 | { |
595 | - if ($resetx) |
|
596 | - $this->x = $this->lMargin; |
|
599 | + if ($resetx) { |
|
600 | + $this->x = $this->lMargin; |
|
601 | + } |
|
597 | 602 | |
598 | 603 | $this->y = $y; |
599 | 604 | } |
@@ -726,9 +731,13 @@ discard block |
||
726 | 731 | $y4 = $y + $h; |
727 | 732 | |
728 | 733 | // get the Closing operator from the PDF Style |
729 | - if ($style == 'F') $op = 'f'; |
|
730 | - elseif ($style == 'FD' || $style == 'DF') $op = 'B'; |
|
731 | - else $op = 'S'; |
|
734 | + if ($style == 'F') { |
|
735 | + $op = 'f'; |
|
736 | + } elseif ($style == 'FD' || $style == 'DF') { |
|
737 | + $op = 'B'; |
|
738 | + } else { |
|
739 | + $op = 'S'; |
|
740 | + } |
|
732 | 741 | |
733 | 742 | // drawing |
734 | 743 | $this->_Point($x1, $y1, true); |
@@ -772,9 +781,13 @@ discard block |
||
772 | 781 | public function svgEllipse($x0, $y0, $rx, $ry, $style) |
773 | 782 | { |
774 | 783 | // get the Closing operator from the PDF Style |
775 | - if ($style == 'F') $op = 'f'; |
|
776 | - elseif ($style == 'FD' || $style == 'DF') $op = 'B'; |
|
777 | - else $op = 'S'; |
|
784 | + if ($style == 'F') { |
|
785 | + $op = 'f'; |
|
786 | + } elseif ($style == 'FD' || $style == 'DF') { |
|
787 | + $op = 'B'; |
|
788 | + } else { |
|
789 | + $op = 'S'; |
|
790 | + } |
|
778 | 791 | |
779 | 792 | // drawing |
780 | 793 | $this->_Arc($x0, $y0, $rx, $ry, 0, 2 * M_PI, true, true, true); |
@@ -791,9 +804,13 @@ discard block |
||
791 | 804 | public function svgPolygone($actions, $style) |
792 | 805 | { |
793 | 806 | // get the Closing operator from the PDF Style |
794 | - if ($style == 'F') $op = 'f'; |
|
795 | - elseif ($style == 'FD' || $style == 'DF') $op = 'B'; |
|
796 | - else $op = 'S'; |
|
807 | + if ($style == 'F') { |
|
808 | + $op = 'f'; |
|
809 | + } elseif ($style == 'FD' || $style == 'DF') { |
|
810 | + $op = 'B'; |
|
811 | + } else { |
|
812 | + $op = 'S'; |
|
813 | + } |
|
797 | 814 | |
798 | 815 | // To save the First action and the last point |
799 | 816 | $first = array('', 0, 0); |
@@ -1004,7 +1021,9 @@ discard block |
||
1004 | 1021 | $trans = false) |
1005 | 1022 | { |
1006 | 1023 | // if we want the no trigo direction : add 2PI to the begin angle, to invert the direction |
1007 | - if ( ! $direction) $angleBegin += M_PI * 2.; |
|
1024 | + if ( ! $direction) { |
|
1025 | + $angleBegin += M_PI * 2.; |
|
1026 | + } |
|
1008 | 1027 | |
1009 | 1028 | // cut in segment to convert in berize curv |
1010 | 1029 | $dt = ($angleEnd - $angleBegin) / self::ARC_NB_SEGMENT; |
@@ -1110,7 +1129,9 @@ discard block |
||
1110 | 1129 | $v['s1']['y'] = -$v['s1']['xr'] * sin($angle) + $v['s1']['yr'] * cos($angle); |
1111 | 1130 | $v['s1']['a1'] = atan2($v['y1'] - $v['s1']['y'], $v['x1'] - $v['s1']['x']); |
1112 | 1131 | $v['s1']['a2'] = atan2($v['y2'] - $v['s1']['y'], $v['x2'] - $v['s1']['x']); |
1113 | - if ($v['s1']['a1'] > $v['s1']['a2']) $v['s1']['a1'] -= 2 * M_PI; |
|
1132 | + if ($v['s1']['a1'] > $v['s1']['a2']) { |
|
1133 | + $v['s1']['a1'] -= 2 * M_PI; |
|
1134 | + } |
|
1114 | 1135 | |
1115 | 1136 | $v['s2'] = array(); |
1116 | 1137 | $v['s2']['t'] = -$v['s1']['t']; |
@@ -1122,7 +1143,9 @@ discard block |
||
1122 | 1143 | $v['s2']['y'] = -$v['s2']['xr'] * sin($angle) + $v['s2']['yr'] * cos($angle); |
1123 | 1144 | $v['s2']['a1'] = atan2($v['y1'] - $v['s2']['y'], $v['x1'] - $v['s2']['x']); |
1124 | 1145 | $v['s2']['a2'] = atan2($v['y2'] - $v['s2']['y'], $v['x2'] - $v['s2']['x']); |
1125 | - if ($v['s2']['a1'] > $v['s2']['a2']) $v['s2']['a1'] -= 2 * M_PI; |
|
1146 | + if ($v['s2']['a1'] > $v['s2']['a2']) { |
|
1147 | + $v['s2']['a1'] -= 2 * M_PI; |
|
1148 | + } |
|
1126 | 1149 | |
1127 | 1150 | if ( ! $l) { |
1128 | 1151 | if ($s) { |
@@ -1170,8 +1193,11 @@ discard block |
||
1170 | 1193 | { |
1171 | 1194 | // load the last Transfomation Matrix |
1172 | 1195 | $nb = count($this->_transf); |
1173 | - if ($nb) $m = $this->_transf[$nb - 1]; |
|
1174 | - else $m = array(1, 0, 0, 1, 0, 0); |
|
1196 | + if ($nb) { |
|
1197 | + $m = $this->_transf[$nb - 1]; |
|
1198 | + } else { |
|
1199 | + $m = array(1, 0, 0, 1, 0, 0); |
|
1200 | + } |
|
1175 | 1201 | |
1176 | 1202 | // apply the Transformation Matrix |
1177 | 1203 | list($x, $y) = array(($x * $m[0] + $y * $m[2] + $m[4]), ($x * $m[1] + $y * $m[3] + $m[5])); |
@@ -1195,11 +1221,16 @@ discard block |
||
1195 | 1221 | { |
1196 | 1222 | // get the last Transformation Matrix |
1197 | 1223 | $nb = count($this->_transf); |
1198 | - if ($nb) $m = $this->_transf[$nb - 1]; |
|
1199 | - else $m = array(1, 0, 0, 1, 0, 0); |
|
1224 | + if ($nb) { |
|
1225 | + $m = $this->_transf[$nb - 1]; |
|
1226 | + } else { |
|
1227 | + $m = array(1, 0, 0, 1, 0, 0); |
|
1228 | + } |
|
1200 | 1229 | |
1201 | 1230 | // if no transform, get the Identity Matrix |
1202 | - if ( ! $n) $n = array(1, 0, 0, 1, 0, 0); |
|
1231 | + if ( ! $n) { |
|
1232 | + $n = array(1, 0, 0, 1, 0, 0); |
|
1233 | + } |
|
1203 | 1234 | |
1204 | 1235 | // create the new Transformation Matrix |
1205 | 1236 | $this->_transf[] = array( |
@@ -1249,7 +1280,9 @@ discard block |
||
1249 | 1280 | $this->write1DBarcode($code, $type, $x, $y, $w, $h, '', $style, 'N'); |
1250 | 1281 | |
1251 | 1282 | // it Label => add the FontSize to the height |
1252 | - if ($labelFontsize) $h += ($labelFontsize); |
|
1283 | + if ($labelFontsize) { |
|
1284 | + $h += ($labelFontsize); |
|
1285 | + } |
|
1253 | 1286 | |
1254 | 1287 | // return the size of the barcode |
1255 | 1288 | return array($w, $h); |
@@ -1307,7 +1340,9 @@ discard block |
||
1307 | 1340 | |
1308 | 1341 | // Offset of the current level |
1309 | 1342 | $level = $this->outlines[$i]['l']; |
1310 | - if ($level > 0) $this->Cell($level * 8); |
|
1343 | + if ($level > 0) { |
|
1344 | + $this->Cell($level * 8); |
|
1345 | + } |
|
1311 | 1346 | |
1312 | 1347 | // Caption (cut to fit on the width page) |
1313 | 1348 | $str = $this->outlines[$i]['t']; |
@@ -115,12 +115,13 @@ discard block |
||
115 | 115 | // if it is a closure tag |
116 | 116 | if ($res['close']) { |
117 | 117 | // HTML validation |
118 | - if (count($parents) < 1) |
|
119 | - throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos'])); |
|
120 | - else if ($parents[count($parents) - 1] != $res['name']) |
|
121 | - throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos'])); |
|
122 | - else |
|
123 | - unset($parents[count($parents) - 1]); |
|
118 | + if (count($parents) < 1) { |
|
119 | + throw new HTML2PDF_exception(3, $res['name'], $this->getHtmlErrorCode($res['html_pos'])); |
|
120 | + } else if ($parents[count($parents) - 1] != $res['name']) { |
|
121 | + throw new HTML2PDF_exception(4, $parents, $this->getHtmlErrorCode($res['html_pos'])); |
|
122 | + } else { |
|
123 | + unset($parents[count($parents) - 1]); |
|
124 | + } |
|
124 | 125 | } else { |
125 | 126 | // if it is a autoclosed tag |
126 | 127 | if ($res['autoclose']) { |
@@ -171,7 +172,9 @@ discard block |
||
171 | 172 | $txt = str_replace(' ', ' ', $txt); |
172 | 173 | |
173 | 174 | // add a break line |
174 | - if ($k > 0) $actions[] = $tagPreBr; |
|
175 | + if ($k > 0) { |
|
176 | + $actions[] = $tagPreBr; |
|
177 | + } |
|
175 | 178 | |
176 | 179 | // save the action |
177 | 180 | $actions[] = array( |
@@ -204,21 +207,26 @@ discard block |
||
204 | 207 | // if it is a Text |
205 | 208 | if ($actions[$k]['name'] == 'write') { |
206 | 209 | // if the tag before the text is a tag to clean => ltrim on the text |
207 | - if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean)) |
|
208 | - $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']); |
|
210 | + if ($k > 0 && in_array($actions[$k - 1]['name'], $tagsToClean)) { |
|
211 | + $actions[$k]['param']['txt'] = ltrim($actions[$k]['param']['txt']); |
|
212 | + } |
|
209 | 213 | |
210 | 214 | // if the tag after the text is a tag to clean => rtrim on the text |
211 | - if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean)) |
|
212 | - $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']); |
|
215 | + if ($k < $nb - 1 && in_array($actions[$k + 1]['name'], $tagsToClean)) { |
|
216 | + $actions[$k]['param']['txt'] = rtrim($actions[$k]['param']['txt']); |
|
217 | + } |
|
213 | 218 | |
214 | 219 | // if the text is empty => remove the action |
215 | - if ( ! strlen($actions[$k]['param']['txt'])) |
|
216 | - unset($actions[$k]); |
|
220 | + if ( ! strlen($actions[$k]['param']['txt'])) { |
|
221 | + unset($actions[$k]); |
|
222 | + } |
|
217 | 223 | } |
218 | 224 | } |
219 | 225 | |
220 | 226 | // if we are not on the level 0 => HTML validator ERROR |
221 | - if (count($parents)) throw new HTML2PDF_exception(5, $parents); |
|
227 | + if (count($parents)) { |
|
228 | + throw new HTML2PDF_exception(5, $parents); |
|
229 | + } |
|
222 | 230 | |
223 | 231 | // save the actions to do |
224 | 232 | $this->code = array_values($actions); |
@@ -265,7 +273,9 @@ discard block |
||
265 | 273 | // if it is a tag |
266 | 274 | if ($parse[1][0]) { |
267 | 275 | // save the previous text if it exists |
268 | - if ($str !== '') $tmp[] = array('txt', $str); |
|
276 | + if ($str !== '') { |
|
277 | + $tmp[] = array('txt', $str); |
|
278 | + } |
|
269 | 279 | |
270 | 280 | // save the tag, with the offset |
271 | 281 | $tmp[] = array('code', trim($parse[1][0]), $offset); |
@@ -282,7 +292,9 @@ discard block |
||
282 | 292 | unset($parse); |
283 | 293 | } |
284 | 294 | // if a text is present in the end, we save it |
285 | - if ($str != '') $tmp[] = array('txt', $str); |
|
295 | + if ($str != '') { |
|
296 | + $tmp[] = array('txt', $str); |
|
297 | + } |
|
286 | 298 | unset($str); |
287 | 299 | } |
288 | 300 | |
@@ -296,7 +308,9 @@ discard block |
||
296 | 308 | { |
297 | 309 | // name of the tag, opening, closure, autoclosure |
298 | 310 | $tag = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)'; |
299 | - if ( ! preg_match('/'.$tag.'/isU', $code, $match)) return null; |
|
311 | + if ( ! preg_match('/'.$tag.'/isU', $code, $match)) { |
|
312 | + return null; |
|
313 | + } |
|
300 | 314 | $close = ($match[1] == '/' ? true : false); |
301 | 315 | $autoclose = preg_match('/\/>$/isU', $code); |
302 | 316 | $name = strtolower($match[2]); |
@@ -315,20 +329,23 @@ discard block |
||
315 | 329 | // read the parameters : nom=valeur |
316 | 330 | $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)'; |
317 | 331 | preg_match_all('/'.$prop.'/is', $code, $match); |
318 | - for ($k = 0; $k < count($match[0]); $k++) |
|
319 | - $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
332 | + for ($k = 0; $k < count($match[0]); $k++) { |
|
333 | + $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
334 | + } |
|
320 | 335 | |
321 | 336 | // read the parameters : nom="valeur" |
322 | 337 | $prop = '([a-zA-Z0-9_]+)=["]([^"]*)["]'; |
323 | 338 | preg_match_all('/'.$prop.'/is', $code, $match); |
324 | - for ($k = 0; $k < count($match[0]); $k++) |
|
325 | - $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
339 | + for ($k = 0; $k < count($match[0]); $k++) { |
|
340 | + $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
341 | + } |
|
326 | 342 | |
327 | 343 | // read the parameters : nom='valeur' |
328 | 344 | $prop = "([a-zA-Z0-9_]+)=[']([^']*)[']"; |
329 | 345 | preg_match_all('/'.$prop.'/is', $code, $match); |
330 | - for ($k = 0; $k < count($match[0]); $k++) |
|
331 | - $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
346 | + for ($k = 0; $k < count($match[0]); $k++) { |
|
347 | + $param[trim(strtolower($match[1][$k]))] = trim($match[2][$k]); |
|
348 | + } |
|
332 | 349 | |
333 | 350 | // compliance of each parameter |
334 | 351 | $color = "#000000"; |
@@ -374,19 +391,25 @@ discard block |
||
374 | 391 | |
375 | 392 | case 'border': |
376 | 393 | unset($param[$key]); |
377 | - if (preg_match('/^[0-9]+$/isU', $val)) $val = $val.'px'; |
|
394 | + if (preg_match('/^[0-9]+$/isU', $val)) { |
|
395 | + $val = $val.'px'; |
|
396 | + } |
|
378 | 397 | $border = $val; |
379 | 398 | break; |
380 | 399 | |
381 | 400 | case 'cellpadding': |
382 | 401 | case 'cellspacing': |
383 | - if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px'; |
|
402 | + if (preg_match('/^([0-9]+)$/isU', $val)) { |
|
403 | + $param[$key] = $val.'px'; |
|
404 | + } |
|
384 | 405 | break; |
385 | 406 | |
386 | 407 | case 'colspan': |
387 | 408 | case 'rowspan': |
388 | 409 | $val = preg_replace('/[^0-9]/isU', '', $val); |
389 | - if ( ! $val) $val = 1; |
|
410 | + if ( ! $val) { |
|
411 | + $val = 1; |
|
412 | + } |
|
390 | 413 | $param[$key] = $val; |
391 | 414 | break; |
392 | 415 | } |
@@ -394,8 +417,11 @@ discard block |
||
394 | 417 | |
395 | 418 | // compliance of the border |
396 | 419 | if ($border !== null) { |
397 | - if ($border) $border = 'border: solid '.$border.' '.$color; |
|
398 | - else $border = 'border: none'; |
|
420 | + if ($border) { |
|
421 | + $border = 'border: solid '.$border.' '.$color; |
|
422 | + } else { |
|
423 | + $border = 'border: none'; |
|
424 | + } |
|
399 | 425 | |
400 | 426 | $param['style'] .= $border.'; '; |
401 | 427 | $param['border'] = $border; |
@@ -458,7 +484,9 @@ discard block |
||
458 | 484 | public function getLevel($k) |
459 | 485 | { |
460 | 486 | // if the code does not exist => return empty |
461 | - if ( ! isset($this->code[$k])) return array(); |
|
487 | + if ( ! isset($this->code[$k])) { |
|
488 | + return array(); |
|
489 | + } |
|
462 | 490 | |
463 | 491 | // the tag to detect |
464 | 492 | $detect = $this->code[$k]['name']; |
@@ -503,16 +531,19 @@ discard block |
||
503 | 531 | |
504 | 532 | // if we can takin into account the current tag => save it |
505 | 533 | if ( ! $not) { |
506 | - if (isset($row['style']['text-align'])) unset($row['style']['text-align']); |
|
534 | + if (isset($row['style']['text-align'])) { |
|
535 | + unset($row['style']['text-align']); |
|
536 | + } |
|
507 | 537 | $code[] = $row; |
508 | 538 | } |
509 | 539 | } |
510 | 540 | |
511 | 541 | // it continues as long as there has code to analise |
512 | - if (isset($this->code[$k + 1])) |
|
513 | - $k++; |
|
514 | - else |
|
515 | - $end = true; |
|
542 | + if (isset($this->code[$k + 1])) { |
|
543 | + $k++; |
|
544 | + } else { |
|
545 | + $end = true; |
|
546 | + } |
|
516 | 547 | } |
517 | 548 | |
518 | 549 | // return the extract |
@@ -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); |
@@ -183,7 +183,9 @@ discard block |
||
183 | 183 | |
184 | 184 | // prepare the Collapse attribute |
185 | 185 | $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false; |
186 | - if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) $collapse = false; |
|
186 | + if ( ! in_array($tagName, array('tr', 'td', 'th', 'thead', 'tbody', 'tfoot'))) { |
|
187 | + $collapse = false; |
|
188 | + } |
|
187 | 189 | |
188 | 190 | // set the global css values |
189 | 191 | $this->value['position'] = null; |
@@ -319,20 +321,23 @@ discard block |
||
319 | 321 | $style = $b.$i; |
320 | 322 | |
321 | 323 | if ($this->_defaultFont) { |
322 | - if ($family == 'arial') |
|
323 | - $family = 'helvetica'; |
|
324 | - elseif ($family == 'symbol' || $family == 'zapfdingbats') |
|
325 | - $style = ''; |
|
324 | + if ($family == 'arial') { |
|
325 | + $family = 'helvetica'; |
|
326 | + } elseif ($family == 'symbol' || $family == 'zapfdingbats') { |
|
327 | + $style = ''; |
|
328 | + } |
|
326 | 329 | |
327 | 330 | $fontkey = $family.$style; |
328 | - if ( ! $this->_pdf->isLoadedFont($fontkey)) |
|
329 | - $family = $this->_defaultFont; |
|
331 | + if ( ! $this->_pdf->isLoadedFont($fontkey)) { |
|
332 | + $family = $this->_defaultFont; |
|
333 | + } |
|
330 | 334 | } |
331 | 335 | |
332 | - if ($family == 'arial') |
|
333 | - $family = 'helvetica'; |
|
334 | - elseif ($family == 'symbol' || $family == 'zapfdingbats') |
|
335 | - $style = ''; |
|
336 | + if ($family == 'arial') { |
|
337 | + $family = 'helvetica'; |
|
338 | + } elseif ($family == 'symbol' || $family == 'zapfdingbats') { |
|
339 | + $style = ''; |
|
340 | + } |
|
336 | 341 | |
337 | 342 | // complete style |
338 | 343 | $style .= $u.$d.$o; |
@@ -380,7 +385,9 @@ discard block |
||
380 | 385 | */ |
381 | 386 | public function restorePosition() |
382 | 387 | { |
383 | - if ($this->value['y'] == $this->_pdf->getY()) $this->_pdf->setY($this->value['yc'], false); |
|
388 | + if ($this->value['y'] == $this->_pdf->getY()) { |
|
389 | + $this->_pdf->setY($this->value['yc'], false); |
|
390 | + } |
|
384 | 391 | } |
385 | 392 | |
386 | 393 | /** |
@@ -401,18 +408,26 @@ discard block |
||
401 | 408 | if ($this->value['position'] == 'relative' || $this->value['position'] == 'absolute') { |
402 | 409 | if ($this->value['right'] !== null) { |
403 | 410 | $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width']; |
404 | - if ($this->value['margin']['r']) $x -= $this->value['margin']['r']; |
|
411 | + if ($this->value['margin']['r']) { |
|
412 | + $x -= $this->value['margin']['r']; |
|
413 | + } |
|
405 | 414 | } else { |
406 | 415 | $x = $this->value['left']; |
407 | - if ($this->value['margin']['l']) $x += $this->value['margin']['l']; |
|
416 | + if ($this->value['margin']['l']) { |
|
417 | + $x += $this->value['margin']['l']; |
|
418 | + } |
|
408 | 419 | } |
409 | 420 | |
410 | 421 | if ($this->value['bottom'] !== null) { |
411 | 422 | $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height']; |
412 | - if ($this->value['margin']['b']) $y -= $this->value['margin']['b']; |
|
423 | + if ($this->value['margin']['b']) { |
|
424 | + $y -= $this->value['margin']['b']; |
|
425 | + } |
|
413 | 426 | } else { |
414 | 427 | $y = $this->value['top']; |
415 | - if ($this->value['margin']['t']) $y += $this->value['margin']['t']; |
|
428 | + if ($this->value['margin']['t']) { |
|
429 | + $y += $this->value['margin']['t']; |
|
430 | + } |
|
416 | 431 | } |
417 | 432 | |
418 | 433 | if ($this->value['position'] == 'relative') { |
@@ -425,8 +440,12 @@ discard block |
||
425 | 440 | } else { |
426 | 441 | $this->value['x'] = $currentX; |
427 | 442 | $this->value['y'] = $currentY; |
428 | - if ($this->value['margin']['l']) $this->value['x'] += $this->value['margin']['l']; |
|
429 | - if ($this->value['margin']['t']) $this->value['y'] += $this->value['margin']['t']; |
|
443 | + if ($this->value['margin']['l']) { |
|
444 | + $this->value['x'] += $this->value['margin']['l']; |
|
445 | + } |
|
446 | + if ($this->value['margin']['t']) { |
|
447 | + $this->value['y'] += $this->value['margin']['t']; |
|
448 | + } |
|
430 | 449 | } |
431 | 450 | |
432 | 451 | // save the new position |
@@ -484,8 +503,12 @@ discard block |
||
484 | 503 | { |
485 | 504 | // prepare |
486 | 505 | $tagName = strtolower($tagName); |
487 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
488 | - $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null; |
|
506 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) { |
|
507 | + $id = null; |
|
508 | + } |
|
509 | + $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) { |
|
510 | + $name = null; |
|
511 | + } |
|
489 | 512 | |
490 | 513 | // read the class attribute |
491 | 514 | $class = array(); |
@@ -534,10 +557,18 @@ discard block |
||
534 | 557 | // adding the style from the tag |
535 | 558 | $styles = array_merge($styles, $param['style']); |
536 | 559 | |
537 | - if (isset($styles['stroke'])) $this->value['svg']['stroke'] = $this->convertToColor($styles['stroke'], $res); |
|
538 | - if (isset($styles['stroke-width'])) $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']); |
|
539 | - if (isset($styles['fill'])) $this->value['svg']['fill'] = $this->convertToColor($styles['fill'], $res); |
|
540 | - if (isset($styles['fill-opacity'])) $this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity']; |
|
560 | + if (isset($styles['stroke'])) { |
|
561 | + $this->value['svg']['stroke'] = $this->convertToColor($styles['stroke'], $res); |
|
562 | + } |
|
563 | + if (isset($styles['stroke-width'])) { |
|
564 | + $this->value['svg']['stroke-width'] = $this->convertToMM($styles['stroke-width']); |
|
565 | + } |
|
566 | + if (isset($styles['fill'])) { |
|
567 | + $this->value['svg']['fill'] = $this->convertToColor($styles['fill'], $res); |
|
568 | + } |
|
569 | + if (isset($styles['fill-opacity'])) { |
|
570 | + $this->value['svg']['fill-opacity'] = 1. * $styles['fill-opacity']; |
|
571 | + } |
|
541 | 572 | |
542 | 573 | return $this->value['svg']; |
543 | 574 | } |
@@ -554,8 +585,12 @@ discard block |
||
554 | 585 | { |
555 | 586 | // prepare the informations |
556 | 587 | $tagName = strtolower($tagName); |
557 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
558 | - $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null; |
|
588 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) { |
|
589 | + $id = null; |
|
590 | + } |
|
591 | + $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) { |
|
592 | + $name = null; |
|
593 | + } |
|
559 | 594 | |
560 | 595 | // get the class names to use |
561 | 596 | $class = array(); |
@@ -594,7 +629,9 @@ discard block |
||
594 | 629 | |
595 | 630 | // merge with the css styles from tag |
596 | 631 | $styles = array_merge($styles, $param['style']); |
597 | - if (isset($param['allwidth']) && ! isset($styles['width'])) $styles['width'] = '100%'; |
|
632 | + if (isset($param['allwidth']) && ! isset($styles['width'])) { |
|
633 | + $styles['width'] = '100%'; |
|
634 | + } |
|
598 | 635 | |
599 | 636 | // reset some styles, depending on the tag name |
600 | 637 | $this->resetStyle($tagName); |
@@ -603,8 +640,9 @@ discard block |
||
603 | 640 | if ($legacy) { |
604 | 641 | foreach ($legacy as $legacyName => $legacyValue) { |
605 | 642 | if (is_array($legacyValue)) { |
606 | - foreach ($legacyValue as $legacy2Name => $legacy2Value) |
|
607 | - $this->value[$legacyName][$legacy2Name] = $legacy2Value; |
|
643 | + foreach ($legacyValue as $legacy2Name => $legacy2Value) { |
|
644 | + $this->value[$legacyName][$legacy2Name] = $legacy2Value; |
|
645 | + } |
|
608 | 646 | } else { |
609 | 647 | $this->value[$legacyName] = $legacyValue; |
610 | 648 | } |
@@ -647,13 +685,17 @@ discard block |
||
647 | 685 | break; |
648 | 686 | |
649 | 687 | case 'text-transform': |
650 | - if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none'; |
|
688 | + if ( ! in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) { |
|
689 | + $val = 'none'; |
|
690 | + } |
|
651 | 691 | $this->value['text-transform'] = $val; |
652 | 692 | break; |
653 | 693 | |
654 | 694 | case 'font-size': |
655 | 695 | $val = $this->convertToMM($val, $this->value['font-size']); |
656 | - if ($val) $this->value['font-size'] = $val; |
|
696 | + if ($val) { |
|
697 | + $this->value['font-size'] = $val; |
|
698 | + } |
|
657 | 699 | break; |
658 | 700 | |
659 | 701 | case 'color': |
@@ -669,7 +711,9 @@ discard block |
||
669 | 711 | |
670 | 712 | case 'text-align': |
671 | 713 | $val = strtolower($val); |
672 | - if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) $val = 'left'; |
|
714 | + if ( ! in_array($val, array('left', 'right', 'center', 'justify', 'li_right'))) { |
|
715 | + $val = 'left'; |
|
716 | + } |
|
673 | 717 | $this->value['text-align'] = $val; |
674 | 718 | break; |
675 | 719 | |
@@ -679,7 +723,9 @@ discard block |
||
679 | 723 | |
680 | 724 | case 'width': |
681 | 725 | $this->value['width'] = $this->convertToMM($val, $this->getLastWidth()); |
682 | - if ($this->value['width'] && substr($val, -1) == '%') $correctWidth = true; |
|
726 | + if ($this->value['width'] && substr($val, -1) == '%') { |
|
727 | + $correctWidth = true; |
|
728 | + } |
|
683 | 729 | $noWidth = false; |
684 | 730 | break; |
685 | 731 | |
@@ -688,18 +734,26 @@ discard block |
||
688 | 734 | break; |
689 | 735 | |
690 | 736 | case 'line-height': |
691 | - if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val * 100).'%'; |
|
737 | + if (preg_match('/^[0-9\.]+$/isU', $val)) { |
|
738 | + $val = floor($val * 100).'%'; |
|
739 | + } |
|
692 | 740 | $this->value['line-height'] = $val; |
693 | 741 | break; |
694 | 742 | |
695 | 743 | case 'rotate': |
696 | - if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null; |
|
697 | - if ($val < 0) $val += 360; |
|
744 | + if ( ! in_array($val, array(0, -90, 90, 180, 270, -180, -270))) { |
|
745 | + $val = null; |
|
746 | + } |
|
747 | + if ($val < 0) { |
|
748 | + $val += 360; |
|
749 | + } |
|
698 | 750 | $this->value['rotate'] = $val; |
699 | 751 | break; |
700 | 752 | |
701 | 753 | case 'overflow': |
702 | - if ( ! in_array($val, array('visible', 'hidden'))) $val = 'visible'; |
|
754 | + if ( ! in_array($val, array('visible', 'hidden'))) { |
|
755 | + $val = 'visible'; |
|
756 | + } |
|
703 | 757 | $this->value['overflow'] = $val; |
704 | 758 | break; |
705 | 759 | |
@@ -893,34 +947,52 @@ discard block |
||
893 | 947 | $val[$valK] = $this->convertToMM($valV, 0); |
894 | 948 | } |
895 | 949 | $this->_duplicateBorder($val); |
896 | - if ($val[0]) $this->value['border']['t']['width'] = $val[0]; |
|
897 | - if ($val[1]) $this->value['border']['r']['width'] = $val[1]; |
|
898 | - if ($val[2]) $this->value['border']['b']['width'] = $val[2]; |
|
899 | - if ($val[3]) $this->value['border']['l']['width'] = $val[3]; |
|
950 | + if ($val[0]) { |
|
951 | + $this->value['border']['t']['width'] = $val[0]; |
|
952 | + } |
|
953 | + if ($val[1]) { |
|
954 | + $this->value['border']['r']['width'] = $val[1]; |
|
955 | + } |
|
956 | + if ($val[2]) { |
|
957 | + $this->value['border']['b']['width'] = $val[2]; |
|
958 | + } |
|
959 | + if ($val[3]) { |
|
960 | + $this->value['border']['l']['width'] = $val[3]; |
|
961 | + } |
|
900 | 962 | break; |
901 | 963 | |
902 | 964 | case 'border-top-width': |
903 | 965 | $val = $this->convertToMM($val, 0); |
904 | - if ($val) $this->value['border']['t']['width'] = $val; |
|
966 | + if ($val) { |
|
967 | + $this->value['border']['t']['width'] = $val; |
|
968 | + } |
|
905 | 969 | break; |
906 | 970 | |
907 | 971 | case 'border-right-width': |
908 | 972 | $val = $this->convertToMM($val, 0); |
909 | - if ($val) $this->value['border']['r']['width'] = $val; |
|
973 | + if ($val) { |
|
974 | + $this->value['border']['r']['width'] = $val; |
|
975 | + } |
|
910 | 976 | break; |
911 | 977 | |
912 | 978 | case 'border-bottom-width': |
913 | 979 | $val = $this->convertToMM($val, 0); |
914 | - if ($val) $this->value['border']['b']['width'] = $val; |
|
980 | + if ($val) { |
|
981 | + $this->value['border']['b']['width'] = $val; |
|
982 | + } |
|
915 | 983 | break; |
916 | 984 | |
917 | 985 | case 'border-left-width': |
918 | 986 | $val = $this->convertToMM($val, 0); |
919 | - if ($val) $this->value['border']['l']['width'] = $val; |
|
987 | + if ($val) { |
|
988 | + $this->value['border']['l']['width'] = $val; |
|
989 | + } |
|
920 | 990 | break; |
921 | 991 | |
922 | 992 | case 'border-collapse': |
923 | - if ($tagName == 'table') $this->value['border']['collapse'] = ($val == 'collapse'); |
|
993 | + if ($tagName == 'table') { |
|
994 | + $this->value['border']['collapse'] = ($val == 'collapse'); |
|
995 | + } |
|
924 | 996 | break; |
925 | 997 | |
926 | 998 | case 'border-radius': |
@@ -932,17 +1004,29 @@ discard block |
||
932 | 1004 | if (count($valH) < 1 || count($valH) > 4) { |
933 | 1005 | break; |
934 | 1006 | } |
935 | - if ( ! isset($valH[1])) $valH[1] = $valH[0]; |
|
936 | - if ( ! isset($valH[2])) $valH = array($valH[0], $valH[0], $valH[1], $valH[1]); |
|
937 | - if ( ! isset($valH[3])) $valH[3] = $valH[1]; |
|
1007 | + if ( ! isset($valH[1])) { |
|
1008 | + $valH[1] = $valH[0]; |
|
1009 | + } |
|
1010 | + if ( ! isset($valH[2])) { |
|
1011 | + $valH = array($valH[0], $valH[0], $valH[1], $valH[1]); |
|
1012 | + } |
|
1013 | + if ( ! isset($valH[3])) { |
|
1014 | + $valH[3] = $valH[1]; |
|
1015 | + } |
|
938 | 1016 | if (isset($val[1])) { |
939 | 1017 | $valV = $this->convertToRadius(trim($val[1])); |
940 | 1018 | if (count($valV) < 1 || count($valV) > 4) { |
941 | 1019 | break; |
942 | 1020 | } |
943 | - if ( ! isset($valV[1])) $valV[1] = $valV[0]; |
|
944 | - if ( ! isset($valV[2])) $valV = array($valV[0], $valV[0], $valV[1], $valV[1]); |
|
945 | - if ( ! isset($valV[3])) $valV[3] = $valV[1]; |
|
1021 | + if ( ! isset($valV[1])) { |
|
1022 | + $valV[1] = $valV[0]; |
|
1023 | + } |
|
1024 | + if ( ! isset($valV[2])) { |
|
1025 | + $valV = array($valV[0], $valV[0], $valV[1], $valV[1]); |
|
1026 | + } |
|
1027 | + if ( ! isset($valV[3])) { |
|
1028 | + $valV[3] = $valV[1]; |
|
1029 | + } |
|
946 | 1030 | } else { |
947 | 1031 | $valV = $valH; |
948 | 1032 | } |
@@ -1024,22 +1108,35 @@ discard block |
||
1024 | 1108 | break; |
1025 | 1109 | |
1026 | 1110 | case 'position': |
1027 | - if ($val == 'absolute') $this->value['position'] = 'absolute'; |
|
1028 | - else if ($val == 'relative') $this->value['position'] = 'relative'; |
|
1029 | - else $this->value['position'] = null; |
|
1111 | + if ($val == 'absolute') { |
|
1112 | + $this->value['position'] = 'absolute'; |
|
1113 | + } else if ($val == 'relative') { |
|
1114 | + $this->value['position'] = 'relative'; |
|
1115 | + } else { |
|
1116 | + $this->value['position'] = null; |
|
1117 | + } |
|
1030 | 1118 | break; |
1031 | 1119 | |
1032 | 1120 | case 'float': |
1033 | - if ($val == 'left') $this->value['float'] = 'left'; |
|
1034 | - else if ($val == 'right') $this->value['float'] = 'right'; |
|
1035 | - else $this->value['float'] = null; |
|
1121 | + if ($val == 'left') { |
|
1122 | + $this->value['float'] = 'left'; |
|
1123 | + } else if ($val == 'right') { |
|
1124 | + $this->value['float'] = 'right'; |
|
1125 | + } else { |
|
1126 | + $this->value['float'] = null; |
|
1127 | + } |
|
1036 | 1128 | break; |
1037 | 1129 | |
1038 | 1130 | case 'display': |
1039 | - if ($val == 'inline') $this->value['display'] = 'inline'; |
|
1040 | - else if ($val == 'block') $this->value['display'] = 'block'; |
|
1041 | - else if ($val == 'none') $this->value['display'] = 'none'; |
|
1042 | - else $this->value['display'] = null; |
|
1131 | + if ($val == 'inline') { |
|
1132 | + $this->value['display'] = 'inline'; |
|
1133 | + } else if ($val == 'block') { |
|
1134 | + $this->value['display'] = 'block'; |
|
1135 | + } else if ($val == 'none') { |
|
1136 | + $this->value['display'] = 'none'; |
|
1137 | + } else { |
|
1138 | + $this->value['display'] = null; |
|
1139 | + } |
|
1043 | 1140 | break; |
1044 | 1141 | |
1045 | 1142 | case 'top': |
@@ -1052,7 +1149,9 @@ discard block |
||
1052 | 1149 | case 'list-style': |
1053 | 1150 | case 'list-style-type': |
1054 | 1151 | case 'list-style-image': |
1055 | - if ($nom == 'list-style') $nom = 'list-style-type'; |
|
1152 | + if ($nom == 'list-style') { |
|
1153 | + $nom = 'list-style-type'; |
|
1154 | + } |
|
1056 | 1155 | $this->value[$nom] = $val; |
1057 | 1156 | break; |
1058 | 1157 | |
@@ -1064,11 +1163,17 @@ discard block |
||
1064 | 1163 | $return = true; |
1065 | 1164 | |
1066 | 1165 | // only for P tag |
1067 | - if ($this->value['margin']['t'] === null) $this->value['margin']['t'] = $this->value['font-size']; |
|
1068 | - if ($this->value['margin']['b'] === null) $this->value['margin']['b'] = $this->value['font-size']; |
|
1166 | + if ($this->value['margin']['t'] === null) { |
|
1167 | + $this->value['margin']['t'] = $this->value['font-size']; |
|
1168 | + } |
|
1169 | + if ($this->value['margin']['b'] === null) { |
|
1170 | + $this->value['margin']['b'] = $this->value['font-size']; |
|
1171 | + } |
|
1069 | 1172 | |
1070 | 1173 | // force the text align to left, if asked by html2pdf |
1071 | - if ($this->_onlyLeft) $this->value['text-align'] = 'left'; |
|
1174 | + if ($this->_onlyLeft) { |
|
1175 | + $this->value['text-align'] = 'left'; |
|
1176 | + } |
|
1072 | 1177 | |
1073 | 1178 | // correction on the width (quick box) |
1074 | 1179 | if ($noWidth && in_array($tagName, array('div', 'blockquote', 'fieldset')) && $this->value['position'] != 'absolute') { |
@@ -1084,30 +1189,60 @@ discard block |
||
1084 | 1189 | $this->value['width'] -= $this->convertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px'); |
1085 | 1190 | $return = false; |
1086 | 1191 | } |
1087 | - if ($this->value['width'] < 0) $this->value['width'] = 0; |
|
1192 | + if ($this->value['width'] < 0) { |
|
1193 | + $this->value['width'] = 0; |
|
1194 | + } |
|
1088 | 1195 | } else { |
1089 | 1196 | if ($this->value['width']) { |
1090 | - if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width']; |
|
1091 | - if ($this->value['border']['r']['width']) $this->value['width'] += $this->value['border']['r']['width']; |
|
1092 | - if ($this->value['padding']['l']) $this->value['width'] += $this->value['padding']['l']; |
|
1093 | - if ($this->value['padding']['r']) $this->value['width'] += $this->value['padding']['r']; |
|
1197 | + if ($this->value['border']['l']['width']) { |
|
1198 | + $this->value['width'] += $this->value['border']['l']['width']; |
|
1199 | + } |
|
1200 | + if ($this->value['border']['r']['width']) { |
|
1201 | + $this->value['width'] += $this->value['border']['r']['width']; |
|
1202 | + } |
|
1203 | + if ($this->value['padding']['l']) { |
|
1204 | + $this->value['width'] += $this->value['padding']['l']; |
|
1205 | + } |
|
1206 | + if ($this->value['padding']['r']) { |
|
1207 | + $this->value['width'] += $this->value['padding']['r']; |
|
1208 | + } |
|
1094 | 1209 | } |
1095 | 1210 | } |
1096 | 1211 | } |
1097 | 1212 | if ($this->value['height']) { |
1098 | - if ($this->value['border']['b']['width']) $this->value['height'] += $this->value['border']['b']['width']; |
|
1099 | - if ($this->value['border']['t']['width']) $this->value['height'] += $this->value['border']['t']['width']; |
|
1100 | - if ($this->value['padding']['b']) $this->value['height'] += $this->value['padding']['b']; |
|
1101 | - if ($this->value['padding']['t']) $this->value['height'] += $this->value['padding']['t']; |
|
1213 | + if ($this->value['border']['b']['width']) { |
|
1214 | + $this->value['height'] += $this->value['border']['b']['width']; |
|
1215 | + } |
|
1216 | + if ($this->value['border']['t']['width']) { |
|
1217 | + $this->value['height'] += $this->value['border']['t']['width']; |
|
1218 | + } |
|
1219 | + if ($this->value['padding']['b']) { |
|
1220 | + $this->value['height'] += $this->value['padding']['b']; |
|
1221 | + } |
|
1222 | + if ($this->value['padding']['t']) { |
|
1223 | + $this->value['height'] += $this->value['padding']['t']; |
|
1224 | + } |
|
1102 | 1225 | } |
1103 | 1226 | |
1104 | - if ($this->value['top'] != null) $this->value['top'] = $this->convertToMM($this->value['top'], $this->getLastHeight(true)); |
|
1105 | - if ($this->value['bottom'] != null) $this->value['bottom'] = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true)); |
|
1106 | - if ($this->value['left'] != null) $this->value['left'] = $this->convertToMM($this->value['left'], $this->getLastWidth(true)); |
|
1107 | - if ($this->value['right'] != null) $this->value['right'] = $this->convertToMM($this->value['right'], $this->getLastWidth(true)); |
|
1227 | + if ($this->value['top'] != null) { |
|
1228 | + $this->value['top'] = $this->convertToMM($this->value['top'], $this->getLastHeight(true)); |
|
1229 | + } |
|
1230 | + if ($this->value['bottom'] != null) { |
|
1231 | + $this->value['bottom'] = $this->convertToMM($this->value['bottom'], $this->getLastHeight(true)); |
|
1232 | + } |
|
1233 | + if ($this->value['left'] != null) { |
|
1234 | + $this->value['left'] = $this->convertToMM($this->value['left'], $this->getLastWidth(true)); |
|
1235 | + } |
|
1236 | + if ($this->value['right'] != null) { |
|
1237 | + $this->value['right'] = $this->convertToMM($this->value['right'], $this->getLastWidth(true)); |
|
1238 | + } |
|
1108 | 1239 | |
1109 | - if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) $this->value['bottom'] = null; |
|
1110 | - if ($this->value['left'] && $this->value['right'] && $this->value['width']) $this->value['right'] = null; |
|
1240 | + if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) { |
|
1241 | + $this->value['bottom'] = null; |
|
1242 | + } |
|
1243 | + if ($this->value['left'] && $this->value['right'] && $this->value['width']) { |
|
1244 | + $this->value['right'] = null; |
|
1245 | + } |
|
1111 | 1246 | |
1112 | 1247 | return $return; |
1113 | 1248 | } |
@@ -1121,7 +1256,9 @@ discard block |
||
1121 | 1256 | public function getLineHeight() |
1122 | 1257 | { |
1123 | 1258 | $val = $this->value['line-height']; |
1124 | - if ($val == 'normal') $val = '108%'; |
|
1259 | + if ($val == 'normal') { |
|
1260 | + $val = '108%'; |
|
1261 | + } |
|
1125 | 1262 | return $this->convertToMM($val, $this->value['font-size']); |
1126 | 1263 | } |
1127 | 1264 | |
@@ -1177,8 +1314,12 @@ discard block |
||
1177 | 1314 | */ |
1178 | 1315 | public function getFloat() |
1179 | 1316 | { |
1180 | - if ($this->value['float'] == 'left') return 'left'; |
|
1181 | - if ($this->value['float'] == 'right') return 'right'; |
|
1317 | + if ($this->value['float'] == 'left') { |
|
1318 | + return 'left'; |
|
1319 | + } |
|
1320 | + if ($this->value['float'] == 'right') { |
|
1321 | + return 'right'; |
|
1322 | + } |
|
1182 | 1323 | return null; |
1183 | 1324 | } |
1184 | 1325 | |
@@ -1208,7 +1349,9 @@ discard block |
||
1208 | 1349 | protected function _getLastAbsoluteX() |
1209 | 1350 | { |
1210 | 1351 | for ($k = count($this->table) - 1; $k >= 0; $k--) { |
1211 | - if ($this->table[$k]['x'] && $this->table[$k]['position']) return $this->table[$k]['x']; |
|
1352 | + if ($this->table[$k]['x'] && $this->table[$k]['position']) { |
|
1353 | + return $this->table[$k]['x']; |
|
1354 | + } |
|
1212 | 1355 | } |
1213 | 1356 | return $this->_pdf->getlMargin(); |
1214 | 1357 | } |
@@ -1222,7 +1365,9 @@ discard block |
||
1222 | 1365 | protected function _getLastAbsoluteY() |
1223 | 1366 | { |
1224 | 1367 | for ($k = count($this->table) - 1; $k >= 0; $k--) { |
1225 | - if ($this->table[$k]['y'] && $this->table[$k]['position']) return $this->table[$k]['y']; |
|
1368 | + if ($this->table[$k]['y'] && $this->table[$k]['position']) { |
|
1369 | + return $this->table[$k]['y']; |
|
1370 | + } |
|
1226 | 1371 | } |
1227 | 1372 | return $this->_pdf->gettMargin(); |
1228 | 1373 | } |
@@ -1364,12 +1509,16 @@ discard block |
||
1364 | 1509 | // else, it could be the color |
1365 | 1510 | } else { |
1366 | 1511 | $tmp = $this->convertToColor($value, $res); |
1367 | - if ($res) $color = $tmp; |
|
1512 | + if ($res) { |
|
1513 | + $color = $tmp; |
|
1514 | + } |
|
1368 | 1515 | } |
1369 | 1516 | } |
1370 | 1517 | |
1371 | 1518 | // if no witdh => return none |
1372 | - if ( ! $width) return $none; |
|
1519 | + if ( ! $width) { |
|
1520 | + return $none; |
|
1521 | + } |
|
1373 | 1522 | |
1374 | 1523 | // return the border properties |
1375 | 1524 | return array('type' => $type, 'width' => $width, 'color' => $color); |
@@ -1474,8 +1623,11 @@ discard block |
||
1474 | 1623 | public function convertBackgroundColor($css) |
1475 | 1624 | { |
1476 | 1625 | $res = null; |
1477 | - if ($css == 'transparent') return null; |
|
1478 | - else return $this->convertToColor($css, $res); |
|
1626 | + if ($css == 'transparent') { |
|
1627 | + return null; |
|
1628 | + } else { |
|
1629 | + return $this->convertToColor($css, $res); |
|
1630 | + } |
|
1479 | 1631 | } |
1480 | 1632 | |
1481 | 1633 | /** |
@@ -1487,12 +1639,13 @@ discard block |
||
1487 | 1639 | */ |
1488 | 1640 | public function convertBackgroundImage($css) |
1489 | 1641 | { |
1490 | - if ($css == 'none') |
|
1491 | - return null; |
|
1492 | - else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match)) |
|
1493 | - return $match[1]; |
|
1494 | - else |
|
1495 | - return null; |
|
1642 | + if ($css == 'none') { |
|
1643 | + return null; |
|
1644 | + } else if (preg_match('/^url\(([^)]*)\)$/isU', $css, $match)) { |
|
1645 | + return $match[1]; |
|
1646 | + } else { |
|
1647 | + return null; |
|
1648 | + } |
|
1496 | 1649 | } |
1497 | 1650 | |
1498 | 1651 | /** |
@@ -1513,10 +1666,14 @@ discard block |
||
1513 | 1666 | |
1514 | 1667 | // we must have 2 values. if 0 or >2 : error. if 1 => put center for 2 |
1515 | 1668 | if (count($css) < 2) { |
1516 | - if ( ! $css[0]) return null; |
|
1669 | + if ( ! $css[0]) { |
|
1670 | + return null; |
|
1671 | + } |
|
1517 | 1672 | $css[1] = 'center'; |
1518 | 1673 | } |
1519 | - if (count($css) > 2) return null; |
|
1674 | + if (count($css) > 2) { |
|
1675 | + return null; |
|
1676 | + } |
|
1520 | 1677 | |
1521 | 1678 | // prepare the values |
1522 | 1679 | $x = 0; |
@@ -1524,24 +1681,42 @@ discard block |
||
1524 | 1681 | $res = true; |
1525 | 1682 | |
1526 | 1683 | // convert the first value |
1527 | - if ($css[0] == 'left') $x = '0%'; |
|
1528 | - else if ($css[0] == 'center') $x = '50%'; |
|
1529 | - else if ($css[0] == 'right') $x = '100%'; |
|
1530 | - else if ($css[0] == 'top') $y = '0%'; |
|
1531 | - else if ($css[0] == 'bottom') $y = '100%'; |
|
1532 | - else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) $x = $css[0]; |
|
1533 | - else if ($this->convertToMM($css[0])) $x = $this->convertToMM($css[0]); |
|
1534 | - else $res = false; |
|
1684 | + if ($css[0] == 'left') { |
|
1685 | + $x = '0%'; |
|
1686 | + } else if ($css[0] == 'center') { |
|
1687 | + $x = '50%'; |
|
1688 | + } else if ($css[0] == 'right') { |
|
1689 | + $x = '100%'; |
|
1690 | + } else if ($css[0] == 'top') { |
|
1691 | + $y = '0%'; |
|
1692 | + } else if ($css[0] == 'bottom') { |
|
1693 | + $y = '100%'; |
|
1694 | + } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[0])) { |
|
1695 | + $x = $css[0]; |
|
1696 | + } else if ($this->convertToMM($css[0])) { |
|
1697 | + $x = $this->convertToMM($css[0]); |
|
1698 | + } else { |
|
1699 | + $res = false; |
|
1700 | + } |
|
1535 | 1701 | |
1536 | 1702 | // convert the second value |
1537 | - if ($css[1] == 'left') $x = '0%'; |
|
1538 | - else if ($css[1] == 'right') $x = '100%'; |
|
1539 | - else if ($css[1] == 'top') $y = '0%'; |
|
1540 | - else if ($css[1] == 'center') $y = '50%'; |
|
1541 | - else if ($css[1] == 'bottom') $y = '100%'; |
|
1542 | - else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) $y = $css[1]; |
|
1543 | - else if ($this->convertToMM($css[1])) $y = $this->convertToMM($css[1]); |
|
1544 | - else $res = false; |
|
1703 | + if ($css[1] == 'left') { |
|
1704 | + $x = '0%'; |
|
1705 | + } else if ($css[1] == 'right') { |
|
1706 | + $x = '100%'; |
|
1707 | + } else if ($css[1] == 'top') { |
|
1708 | + $y = '0%'; |
|
1709 | + } else if ($css[1] == 'center') { |
|
1710 | + $y = '50%'; |
|
1711 | + } else if ($css[1] == 'bottom') { |
|
1712 | + $y = '100%'; |
|
1713 | + } else if (preg_match('/^[-]?[0-9\.]+%$/isU', $css[1])) { |
|
1714 | + $y = $css[1]; |
|
1715 | + } else if ($this->convertToMM($css[1])) { |
|
1716 | + $y = $this->convertToMM($css[1]); |
|
1717 | + } else { |
|
1718 | + $res = false; |
|
1719 | + } |
|
1545 | 1720 | |
1546 | 1721 | // return the values |
1547 | 1722 | return array($x, $y); |
@@ -1581,13 +1756,22 @@ discard block |
||
1581 | 1756 | public function convertToMM($css, $old = 0.) |
1582 | 1757 | { |
1583 | 1758 | $css = trim($css); |
1584 | - if (preg_match('/^[0-9\.\-]+$/isU', $css)) $css .= 'px'; |
|
1585 | - if (preg_match('/^[0-9\.\-]+px$/isU', $css)) $css = 25.4 / 96. * str_replace('px', '', $css); |
|
1586 | - else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) $css = 25.4 / 72. * str_replace('pt', '', $css); |
|
1587 | - else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) $css = 25.4 * str_replace('in', '', $css); |
|
1588 | - else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) $css = 1. * str_replace('mm', '', $css); |
|
1589 | - else if (preg_match('/^[0-9\.\-]+%$/isU', $css)) $css = 1. * $old * str_replace('%', '', $css) / 100.; |
|
1590 | - else $css = null; |
|
1759 | + if (preg_match('/^[0-9\.\-]+$/isU', $css)) { |
|
1760 | + $css .= 'px'; |
|
1761 | + } |
|
1762 | + if (preg_match('/^[0-9\.\-]+px$/isU', $css)) { |
|
1763 | + $css = 25.4 / 96. * str_replace('px', '', $css); |
|
1764 | + } else if (preg_match('/^[0-9\.\-]+pt$/isU', $css)) { |
|
1765 | + $css = 25.4 / 72. * str_replace('pt', '', $css); |
|
1766 | + } else if (preg_match('/^[0-9\.\-]+in$/isU', $css)) { |
|
1767 | + $css = 25.4 * str_replace('in', '', $css); |
|
1768 | + } else if (preg_match('/^[0-9\.\-]+mm$/isU', $css)) { |
|
1769 | + $css = 1. * str_replace('mm', '', $css); |
|
1770 | + } else if (preg_match('/^[0-9\.\-]+%$/isU', $css)) { |
|
1771 | + $css = 1. * $old * str_replace('%', '', $css) / 100.; |
|
1772 | + } else { |
|
1773 | + $css = null; |
|
1774 | + } |
|
1591 | 1775 | |
1592 | 1776 | return $css; |
1593 | 1777 | } |
@@ -1636,7 +1820,9 @@ discard block |
||
1636 | 1820 | $res = true; |
1637 | 1821 | |
1638 | 1822 | // if transparent => return null |
1639 | - if (strtolower($css) == 'transparent') return array(null, null, null); |
|
1823 | + if (strtolower($css) == 'transparent') { |
|
1824 | + return array(null, null, null); |
|
1825 | + } |
|
1640 | 1826 | |
1641 | 1827 | // HTML color |
1642 | 1828 | if (isset($this->_htmlColor[strtolower($css)])) { |
@@ -1697,7 +1883,9 @@ discard block |
||
1697 | 1883 | $c = floatVal(substr($c, 0, -1)) / 100.; |
1698 | 1884 | } else { |
1699 | 1885 | $c = floatVal($c); |
1700 | - if ($c > 1) $c = $c / 255.; |
|
1886 | + if ($c > 1) { |
|
1887 | + $c = $c / 255.; |
|
1888 | + } |
|
1701 | 1889 | } |
1702 | 1890 | |
1703 | 1891 | return $c; |
@@ -1751,13 +1939,16 @@ discard block |
||
1751 | 1939 | $name = trim($name); |
1752 | 1940 | |
1753 | 1941 | // if a selector with somethink lige :hover => continue |
1754 | - if (strpos($name, ':') !== false) continue; |
|
1942 | + if (strpos($name, ':') !== false) { |
|
1943 | + continue; |
|
1944 | + } |
|
1755 | 1945 | |
1756 | 1946 | // save the value |
1757 | - if ( ! isset($this->css[$name])) |
|
1758 | - $this->css[$name] = $css; |
|
1759 | - else |
|
1760 | - $this->css[$name] = array_merge($this->css[$name], $css); |
|
1947 | + if ( ! isset($this->css[$name])) { |
|
1948 | + $this->css[$name] = $css; |
|
1949 | + } else { |
|
1950 | + $this->css[$name] = array_merge($this->css[$name], $css); |
|
1951 | + } |
|
1761 | 1952 | |
1762 | 1953 | } |
1763 | 1954 | } |
@@ -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(); |
@@ -357,14 +359,24 @@ discard block |
||
357 | 359 | } |
358 | 360 | |
359 | 361 | // complete parameters |
360 | - if ($dest === false) $dest = 'I'; |
|
361 | - if ($dest === true) $dest = 'S'; |
|
362 | - if ($dest === '') $dest = 'I'; |
|
363 | - if ($name == '') $name = 'document.pdf'; |
|
362 | + if ($dest === false) { |
|
363 | + $dest = 'I'; |
|
364 | + } |
|
365 | + if ($dest === true) { |
|
366 | + $dest = 'S'; |
|
367 | + } |
|
368 | + if ($dest === '') { |
|
369 | + $dest = 'I'; |
|
370 | + } |
|
371 | + if ($name == '') { |
|
372 | + $name = 'document.pdf'; |
|
373 | + } |
|
364 | 374 | |
365 | 375 | // clean up the destination |
366 | 376 | $dest = strtoupper($dest); |
367 | - if ( ! in_array($dest, array('I', 'D', 'F', 'S', 'FI', 'FD'))) $dest = 'I'; |
|
377 | + if ( ! in_array($dest, array('I', 'D', 'F', 'S', 'FI', 'FD'))) { |
|
378 | + $dest = 'I'; |
|
379 | + } |
|
368 | 380 | |
369 | 381 | // the name must be a PDF name |
370 | 382 | if (strtolower(substr($name, -4)) != '.pdf') { |
@@ -425,20 +437,24 @@ discard block |
||
425 | 437 | |
426 | 438 | // extract the content |
427 | 439 | $res = explode('<body', $html); |
428 | - if (count($res) < 2) return $html; |
|
440 | + if (count($res) < 2) { |
|
441 | + return $html; |
|
442 | + } |
|
429 | 443 | $content = '<page'.$res[1]; |
430 | 444 | $content = explode('</body', $content); |
431 | 445 | $content = $content[0].'</page>'; |
432 | 446 | |
433 | 447 | // extract the link tags |
434 | 448 | preg_match_all('/<link([^>]*)>/isU', $html, $match); |
435 | - foreach ($match[0] as $src) |
|
436 | - $content = $src.'</link>'.$content; |
|
449 | + foreach ($match[0] as $src) { |
|
450 | + $content = $src.'</link>'.$content; |
|
451 | + } |
|
437 | 452 | |
438 | 453 | // extract the css style tags |
439 | 454 | preg_match_all('/<style[^>]*>(.*)<\/style[^>]*>/isU', $html, $match); |
440 | - foreach ($match[0] as $src) |
|
441 | - $content = $src.$content; |
|
455 | + foreach ($match[0] as $src) { |
|
456 | + $content = $src.$content; |
|
457 | + } |
|
442 | 458 | |
443 | 459 | return $content; |
444 | 460 | } |
@@ -516,8 +532,12 @@ discard block |
||
516 | 532 | */ |
517 | 533 | protected function _setDefaultMargins($left, $top, $right = null, $bottom = null) |
518 | 534 | { |
519 | - if ($right === null) $right = $left; |
|
520 | - if ($bottom === null) $bottom = 8; |
|
535 | + if ($right === null) { |
|
536 | + $right = $left; |
|
537 | + } |
|
538 | + if ($bottom === null) { |
|
539 | + $bottom = 8; |
|
540 | + } |
|
521 | 541 | |
522 | 542 | $this->_defaultLeft = $this->parsingCss->ConvertToMM($left.'mm'); |
523 | 543 | $this->_defaultTop = $this->parsingCss->ConvertToMM($top.'mm'); |
@@ -621,7 +641,9 @@ discard block |
||
621 | 641 | protected function _DEBUG_add($name, $level = null) |
622 | 642 | { |
623 | 643 | // if true : UP |
624 | - if ($level === true) $this->_debugLevel++; |
|
644 | + if ($level === true) { |
|
645 | + $this->_debugLevel++; |
|
646 | + } |
|
625 | 647 | |
626 | 648 | $name = str_repeat(' ', $this->_debugLevel).$name.($level === true ? ' Begin' : ($level === false ? ' End' : '')); |
627 | 649 | $time = microtime(true); |
@@ -639,7 +661,9 @@ discard block |
||
639 | 661 | $this->_debugLastTime = $time; |
640 | 662 | |
641 | 663 | // it false : DOWN |
642 | - if ($level === false) $this->_debugLevel--; |
|
664 | + if ($level === false) { |
|
665 | + $this->_debugLevel--; |
|
666 | + } |
|
643 | 667 | |
644 | 668 | return $this; |
645 | 669 | } |
@@ -678,8 +702,9 @@ discard block |
||
678 | 702 | $y = floor($y * 100); |
679 | 703 | $x = array($this->pdf->getlMargin(), $this->pdf->getW() - $this->pdf->getrMargin()); |
680 | 704 | |
681 | - foreach ($this->_pageMarges as $mY => $mX) |
|
682 | - if ($mY <= $y) $x = $mX; |
|
705 | + foreach ($this->_pageMarges as $mY => $mX) { |
|
706 | + if ($mY <= $y) $x = $mX; |
|
707 | + } |
|
683 | 708 | |
684 | 709 | return $x; |
685 | 710 | } |
@@ -701,18 +726,30 @@ discard block |
||
701 | 726 | $oldBottom = $this->_getMargins($yBottom); |
702 | 727 | |
703 | 728 | // update the top float margin |
704 | - if ($float == 'left' && $oldTop[0] < $xRight) $oldTop[0] = $xRight; |
|
705 | - 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 | + } |
|
706 | 735 | |
707 | 736 | $yTop = floor($yTop * 100); |
708 | 737 | $yBottom = floor($yBottom * 100); |
709 | 738 | |
710 | 739 | // erase all the float margins that are smaller than the new one |
711 | 740 | foreach ($this->_pageMarges as $mY => $mX) { |
712 | - if ($mY < $yTop) continue; |
|
713 | - if ($mY > $yBottom) break; |
|
714 | - if ($float == 'left' && $this->_pageMarges[$mY][0] < $xRight) unset($this->_pageMarges[$mY]); |
|
715 | - 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 | + } |
|
716 | 753 | } |
717 | 754 | |
718 | 755 | // save the new Top and Bottom margins |
@@ -810,7 +847,9 @@ discard block |
||
810 | 847 | */ |
811 | 848 | protected function _setPageHeader() |
812 | 849 | { |
813 | - if ( ! count($this->_subHEADER)) return false; |
|
850 | + if ( ! count($this->_subHEADER)) { |
|
851 | + return false; |
|
852 | + } |
|
814 | 853 | |
815 | 854 | $oldParsePos = $this->_parsePos; |
816 | 855 | $oldParseCode = $this->parsingHtml->code; |
@@ -830,7 +869,9 @@ discard block |
||
830 | 869 | */ |
831 | 870 | protected function _setPageFooter() |
832 | 871 | { |
833 | - if ( ! count($this->_subFOOTER)) return false; |
|
872 | + if ( ! count($this->_subFOOTER)) { |
|
873 | + return false; |
|
874 | + } |
|
834 | 875 | |
835 | 876 | $oldParsePos = $this->_parsePos; |
836 | 877 | $oldParseCode = $this->parsingHtml->code; |
@@ -891,15 +932,18 @@ discard block |
||
891 | 932 | $txt = $sub->parsingHtml->code[$this->_parsePos]['param']['txt']; |
892 | 933 | $txt = str_replace('[[page_cu]]', $sub->pdf->getMyNumPage($this->_page), $txt); |
893 | 934 | $sub->parsingHtml->code[$this->_parsePos]['param']['txt'] = substr($txt, $curr + 1); |
894 | - } else |
|
895 | - $sub->_parsePos++; |
|
935 | + } else { |
|
936 | + $sub->_parsePos++; |
|
937 | + } |
|
896 | 938 | |
897 | 939 | // for each element of the parsing => load the action |
898 | 940 | $res = null; |
899 | 941 | for ($sub->_parsePos; $sub->_parsePos < count($sub->parsingHtml->code); $sub->_parsePos++) { |
900 | 942 | $action = $sub->parsingHtml->code[$sub->_parsePos]; |
901 | 943 | $res = $sub->_executeAction($action); |
902 | - if ( ! $res) break; |
|
944 | + if ( ! $res) { |
|
945 | + break; |
|
946 | + } |
|
903 | 947 | } |
904 | 948 | |
905 | 949 | $w = $sub->_maxX; // max width |
@@ -910,12 +954,13 @@ discard block |
||
910 | 954 | $this->_destroySubHTML($sub); |
911 | 955 | |
912 | 956 | // adapt the start of the line, depending on the text-align |
913 | - if ($this->parsingCss->value['text-align'] == 'center') |
|
914 | - $this->pdf->setX(($rx + $this->pdf->getX() - $w) * 0.5 - 0.01); |
|
915 | - else if ($this->parsingCss->value['text-align'] == 'right') |
|
916 | - $this->pdf->setX($rx - $w - 0.01); |
|
917 | - else |
|
918 | - $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 | + } |
|
919 | 964 | |
920 | 965 | // set the height of the line |
921 | 966 | $this->_currentH = $h; |
@@ -1028,8 +1073,12 @@ discard block |
||
1028 | 1073 | $nbBaseFive = array('V', 'L', 'D'); |
1029 | 1074 | $nbRoman = ''; |
1030 | 1075 | |
1031 | - if ($nbArabic < 1) return $nbArabic; |
|
1032 | - if ($nbArabic > 3999) return $nbArabic; |
|
1076 | + if ($nbArabic < 1) { |
|
1077 | + return $nbArabic; |
|
1078 | + } |
|
1079 | + if ($nbArabic > 3999) { |
|
1080 | + return $nbArabic; |
|
1081 | + } |
|
1033 | 1082 | |
1034 | 1083 | for ($i = 3; $i >= 0; $i--) { |
1035 | 1084 | $chiffre = floor($nbArabic / pow(10, $i)); |
@@ -1162,12 +1211,19 @@ discard block |
||
1162 | 1211 | } |
1163 | 1212 | |
1164 | 1213 | // prepare the datas |
1165 | - if ( ! in_array($type, array('ul', 'ol'))) $type = 'ul'; |
|
1166 | - 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 | + } |
|
1167 | 1220 | |
1168 | 1221 | if ( ! $style) { |
1169 | - if ($type == 'ul') $style = 'disc'; |
|
1170 | - else $style = 'decimal'; |
|
1222 | + if ($type == 'ul') { |
|
1223 | + $style = 'disc'; |
|
1224 | + } else { |
|
1225 | + $style = 'decimal'; |
|
1226 | + } |
|
1171 | 1227 | } |
1172 | 1228 | |
1173 | 1229 | // add the new level |
@@ -1276,8 +1332,9 @@ discard block |
||
1276 | 1332 | */ |
1277 | 1333 | protected function _getElementY($h) |
1278 | 1334 | { |
1279 | - if ($this->_subPart || $this->_isSubPart || ! $this->_currentH || $this->_currentH < $h) |
|
1280 | - return 0; |
|
1335 | + if ($this->_subPart || $this->_isSubPart || ! $this->_currentH || $this->_currentH < $h) { |
|
1336 | + return 0; |
|
1337 | + } |
|
1281 | 1338 | |
1282 | 1339 | return ($this->_currentH - $h) * 0.8; |
1283 | 1340 | } |
@@ -1292,10 +1349,11 @@ discard block |
||
1292 | 1349 | protected function _makeBreakLine($h, $curr = null) |
1293 | 1350 | { |
1294 | 1351 | if ($h) { |
1295 | - if (($this->pdf->getY() + $h < $this->pdf->getH() - $this->pdf->getbMargin()) || $this->_isInOverflow || $this->_isInFooter) |
|
1296 | - $this->_setNewLine($h, $curr); |
|
1297 | - else |
|
1298 | - $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 | + } |
|
1299 | 1357 | } else { |
1300 | 1358 | $this->_setNewPositionForNewLine($curr); |
1301 | 1359 | } |
@@ -1419,7 +1477,9 @@ discard block |
||
1419 | 1477 | |
1420 | 1478 | // calculate the position of the image, if align to the right |
1421 | 1479 | if ($parentWidth > $w && $float != 'left') { |
1422 | - 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 | + } |
|
1423 | 1483 | } |
1424 | 1484 | |
1425 | 1485 | // display the image |
@@ -1490,7 +1550,9 @@ discard block |
||
1490 | 1550 | protected function _drawRectangle($x, $y, $w, $h, $border, $padding, $margin, $background) |
1491 | 1551 | { |
1492 | 1552 | // if we are in a subpart or if height is null => return false |
1493 | - if ($this->_subPart || $this->_isSubPart || $h === null) return false; |
|
1553 | + if ($this->_subPart || $this->_isSubPart || $h === null) { |
|
1554 | + return false; |
|
1555 | + } |
|
1494 | 1556 | |
1495 | 1557 | // add the margin |
1496 | 1558 | $x += $margin; |
@@ -1533,10 +1595,18 @@ discard block |
||
1533 | 1595 | $inBL[1] -= $border['b']['width']; |
1534 | 1596 | } |
1535 | 1597 | |
1536 | - if ($inTL[0] <= 0 || $inTL[1] <= 0) $inTL = null; |
|
1537 | - if ($inTR[0] <= 0 || $inTR[1] <= 0) $inTR = null; |
|
1538 | - if ($inBR[0] <= 0 || $inBR[1] <= 0) $inBR = null; |
|
1539 | - 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 | + } |
|
1540 | 1610 | |
1541 | 1611 | // prepare the background color |
1542 | 1612 | $pdfStyle = ''; |
@@ -1594,13 +1664,21 @@ discard block |
||
1594 | 1664 | $imageHeight = 72. / 96. * $imageInfos[1] / $this->pdf->getK(); |
1595 | 1665 | |
1596 | 1666 | // prepare the position of the backgroung |
1597 | - if ($iRepeat[0]) $iPosition[0] = $bX; |
|
1598 | - else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[0], $match)) $iPosition[0] = $bX + $match[1] * ($bW - $imageWidth) / 100; |
|
1599 | - 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 | + } |
|
1600 | 1674 | |
1601 | - if ($iRepeat[1]) $iPosition[1] = $bY; |
|
1602 | - else if (preg_match('/^([-]?[0-9\.]+)%/isU', $iPosition[1], $match)) $iPosition[1] = $bY + $match[1] * ($bH - $imageHeight) / 100; |
|
1603 | - 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 | + } |
|
1604 | 1682 | |
1605 | 1683 | $imageXmin = $bX; |
1606 | 1684 | $imageXmax = $bX + $bW; |
@@ -1652,10 +1730,18 @@ discard block |
||
1652 | 1730 | $y -= $loose; |
1653 | 1731 | $w += 2. * $loose; |
1654 | 1732 | $h += 2. * $loose; |
1655 | - if ($border['l']['width']) $border['l']['width'] += 2. * $loose; |
|
1656 | - if ($border['t']['width']) $border['t']['width'] += 2. * $loose; |
|
1657 | - if ($border['r']['width']) $border['r']['width'] += 2. * $loose; |
|
1658 | - 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 | + } |
|
1659 | 1745 | |
1660 | 1746 | // prepare the test on borders |
1661 | 1747 | $testBl = ($border['l']['width'] && $border['l']['color'][0] !== null); |
@@ -1753,13 +1839,17 @@ discard block |
||
1753 | 1839 | if (is_array($outBL)) { |
1754 | 1840 | $bord -= 1; |
1755 | 1841 | $pt[3] -= $outBL[1] - $border['b']['width']; |
1756 | - if ($inBL) $pt[11] -= $inBL[1]; |
|
1842 | + if ($inBL) { |
|
1843 | + $pt[11] -= $inBL[1]; |
|
1844 | + } |
|
1757 | 1845 | unset($pt[0]); unset($pt[1]); |
1758 | 1846 | } |
1759 | 1847 | if (is_array($outTL)) { |
1760 | 1848 | $bord -= 2; |
1761 | 1849 | $pt[5] += $outTL[1] - $border['t']['width']; |
1762 | - if ($inTL) $pt[9] += $inTL[1]; |
|
1850 | + if ($inTL) { |
|
1851 | + $pt[9] += $inTL[1]; |
|
1852 | + } |
|
1763 | 1853 | unset($pt[6]); unset($pt[7]); |
1764 | 1854 | } |
1765 | 1855 | |
@@ -1781,13 +1871,17 @@ discard block |
||
1781 | 1871 | if (is_array($outTL)) { |
1782 | 1872 | $bord -= 1; |
1783 | 1873 | $pt[2] += $outTL[0] - $border['l']['width']; |
1784 | - if ($inTL) $pt[10] += $inTL[0]; |
|
1874 | + if ($inTL) { |
|
1875 | + $pt[10] += $inTL[0]; |
|
1876 | + } |
|
1785 | 1877 | unset($pt[0]); unset($pt[1]); |
1786 | 1878 | } |
1787 | 1879 | if (is_array($outTR)) { |
1788 | 1880 | $bord -= 2; |
1789 | 1881 | $pt[4] -= $outTR[0] - $border['r']['width']; |
1790 | - if ($inTR) $pt[8] -= $inTR[0]; |
|
1882 | + if ($inTR) { |
|
1883 | + $pt[8] -= $inTR[0]; |
|
1884 | + } |
|
1791 | 1885 | unset($pt[6]); unset($pt[7]); |
1792 | 1886 | } |
1793 | 1887 | |
@@ -1809,13 +1903,17 @@ discard block |
||
1809 | 1903 | if (is_array($outTR)) { |
1810 | 1904 | $bord -= 1; |
1811 | 1905 | $pt[3] += $outTR[1] - $border['t']['width']; |
1812 | - if ($inTR) $pt[11] += $inTR[1]; |
|
1906 | + if ($inTR) { |
|
1907 | + $pt[11] += $inTR[1]; |
|
1908 | + } |
|
1813 | 1909 | unset($pt[0]); unset($pt[1]); |
1814 | 1910 | } |
1815 | 1911 | if (is_array($outBR)) { |
1816 | 1912 | $bord -= 2; |
1817 | 1913 | $pt[5] -= $outBR[1] - $border['b']['width']; |
1818 | - if ($inBR) $pt[9] -= $inBR[1]; |
|
1914 | + if ($inBR) { |
|
1915 | + $pt[9] -= $inBR[1]; |
|
1916 | + } |
|
1819 | 1917 | unset($pt[6]); unset($pt[7]); |
1820 | 1918 | } |
1821 | 1919 | |
@@ -1837,13 +1935,17 @@ discard block |
||
1837 | 1935 | if (is_array($outBL)) { |
1838 | 1936 | $bord -= 2; |
1839 | 1937 | $pt[4] += $outBL[0] - $border['l']['width']; |
1840 | - if ($inBL) $pt[8] += $inBL[0]; |
|
1938 | + if ($inBL) { |
|
1939 | + $pt[8] += $inBL[0]; |
|
1940 | + } |
|
1841 | 1941 | unset($pt[6]); unset($pt[7]); |
1842 | 1942 | } |
1843 | 1943 | if (is_array($outBR)) { |
1844 | 1944 | $bord -= 1; |
1845 | 1945 | $pt[2] -= $outBR[0] - $border['r']['width']; |
1846 | - if ($inBR) $pt[10] -= $inBR[0]; |
|
1946 | + if ($inBR) { |
|
1947 | + $pt[10] -= $inBR[0]; |
|
1948 | + } |
|
1847 | 1949 | unset($pt[0]); unset($pt[1]); |
1848 | 1950 | |
1849 | 1951 | } |
@@ -1870,10 +1972,11 @@ discard block |
||
1870 | 1972 | { |
1871 | 1973 | $this->pdf->setFillColorArray($color); |
1872 | 1974 | |
1873 | - if (count($pt) == 10) |
|
1874 | - $this->pdf->drawCurve($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]); |
|
1875 | - else |
|
1876 | - $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 | + } |
|
1877 | 1980 | } |
1878 | 1981 | |
1879 | 1982 | /** |
@@ -1944,10 +2047,18 @@ discard block |
||
1944 | 2047 | for ($i = 0; $l - ($px + $py) * ($i - 0.5) > 0; $i++) { |
1945 | 2048 | if (($i % 2) == $mode) { |
1946 | 2049 | $j = $i - 0.5; |
1947 | - $lx1 = $px * ($j); if ($lx1 < -$l) $lx1 = -$l; |
|
1948 | - $ly1 = $py * ($j); if ($ly1 < -$l) $ly1 = -$l; |
|
1949 | - $lx2 = $px * ($j + 1); if ($lx2 > $l) $lx2 = $l; |
|
1950 | - $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 | + } |
|
1951 | 2062 | |
1952 | 2063 | $tmp = array(); |
1953 | 2064 | $tmp[] = $x1 + $lx1; $tmp[] = $y1 + $ly1; |
@@ -2023,10 +2134,14 @@ discard block |
||
2023 | 2134 | protected function _prepareTransform($transform) |
2024 | 2135 | { |
2025 | 2136 | // it can not be empty |
2026 | - if ( ! $transform) return null; |
|
2137 | + if ( ! $transform) { |
|
2138 | + return null; |
|
2139 | + } |
|
2027 | 2140 | |
2028 | 2141 | // sctions must be like scale(...) |
2029 | - 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 | + } |
|
2030 | 2145 | |
2031 | 2146 | // prepare the list of the actions |
2032 | 2147 | $actions = array(); |
@@ -2047,49 +2162,115 @@ discard block |
||
2047 | 2162 | switch ($name) |
2048 | 2163 | { |
2049 | 2164 | case 'scale': |
2050 | - if ( ! isset($val[0])) $val[0] = 1.; else $val[0] = 1. * $val[0]; |
|
2051 | - 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 | + } |
|
2052 | 2175 | $actions[] = array($val[0], 0, 0, $val[1], 0, 0); |
2053 | 2176 | break; |
2054 | 2177 | |
2055 | 2178 | case 'translate': |
2056 | - if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $this->parsingCss->ConvertToMM($val[0], $this->_isInDraw['w']); |
|
2057 | - 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 | + } |
|
2058 | 2189 | $actions[] = array(1, 0, 0, 1, $val[0], $val[1]); |
2059 | 2190 | break; |
2060 | 2191 | |
2061 | 2192 | case 'rotate': |
2062 | - if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $val[0] * M_PI / 180.; |
|
2063 | - if ( ! isset($val[1])) $val[1] = 0.; else $val[1] = $this->parsingCss->ConvertToMM($val[1], $this->_isInDraw['w']); |
|
2064 | - if ( ! isset($val[2])) $val[2] = 0.; else $val[2] = $this->parsingCss->ConvertToMM($val[2], $this->_isInDraw['h']); |
|
2065 | - 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 | + } |
|
2066 | 2211 | $actions[] = array(cos($val[0]), sin($val[0]), -sin($val[0]), cos($val[0]), 0, 0); |
2067 | - 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 | + } |
|
2068 | 2215 | break; |
2069 | 2216 | |
2070 | 2217 | case 'skewx': |
2071 | - 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 | + } |
|
2072 | 2223 | $actions[] = array(1, 0, tan($val[0]), 1, 0, 0); |
2073 | 2224 | break; |
2074 | 2225 | |
2075 | 2226 | case 'skewy': |
2076 | - 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 | + } |
|
2077 | 2232 | $actions[] = array(1, tan($val[0]), 0, 1, 0, 0); |
2078 | 2233 | break; |
2079 | 2234 | case 'matrix': |
2080 | - if ( ! isset($val[0])) $val[0] = 0.; else $val[0] = $val[0] * 1.; |
|
2081 | - if ( ! isset($val[1])) $val[1] = 0.; else $val[1] = $val[1] * 1.; |
|
2082 | - if ( ! isset($val[2])) $val[2] = 0.; else $val[2] = $val[2] * 1.; |
|
2083 | - if ( ! isset($val[3])) $val[3] = 0.; else $val[3] = $val[3] * 1.; |
|
2084 | - if ( ! isset($val[4])) $val[4] = 0.; else $val[4] = $this->parsingCss->ConvertToMM($val[4], $this->_isInDraw['w']); |
|
2085 | - 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 | + } |
|
2086 | 2265 | $actions[] = $val; |
2087 | 2266 | break; |
2088 | 2267 | } |
2089 | 2268 | } |
2090 | 2269 | |
2091 | 2270 | // if ther is no actions => return |
2092 | - if ( ! $actions) return null; |
|
2271 | + if ( ! $actions) { |
|
2272 | + return null; |
|
2273 | + } |
|
2093 | 2274 | |
2094 | 2275 | // get the first matrix |
2095 | 2276 | $m = $actions[0]; unset($actions[0]); |
@@ -2117,7 +2298,9 @@ discard block |
||
2117 | 2298 | */ |
2118 | 2299 | protected function _calculateTableCellSize(&$cases, &$corr) |
2119 | 2300 | { |
2120 | - if ( ! isset($corr[0])) return true; |
|
2301 | + if ( ! isset($corr[0])) { |
|
2302 | + return true; |
|
2303 | + } |
|
2121 | 2304 | |
2122 | 2305 | // for each cell without colspan, we get the max width for each column |
2123 | 2306 | $sw = array(); |
@@ -2137,7 +2320,9 @@ discard block |
||
2137 | 2320 | if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][2] > 1) { |
2138 | 2321 | |
2139 | 2322 | // sum the max width of each column in colspan |
2140 | - $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 | + } |
|
2141 | 2326 | |
2142 | 2327 | // if the max width is < the width of the cell with colspan => we adapt the width of each max width |
2143 | 2328 | if ($s > 0 && $s < $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']) { |
@@ -2186,7 +2371,9 @@ discard block |
||
2186 | 2371 | if (isset($corr[$y][$x]) && is_array($corr[$y][$x]) && $corr[$y][$x][3] > 1) { |
2187 | 2372 | |
2188 | 2373 | // sum the max height of each line in rowspan |
2189 | - $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 | + } |
|
2190 | 2377 | |
2191 | 2378 | // if the max height is < the height of the cell with rowspan => we adapt the height of each max height |
2192 | 2379 | if ($s > 0 && $s < $cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']) { |
@@ -2236,8 +2423,12 @@ discard block |
||
2236 | 2423 | */ |
2237 | 2424 | protected function _tag_open_PAGE($param) |
2238 | 2425 | { |
2239 | - if ($this->_isForOneLine) return false; |
|
2240 | - 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 | + } |
|
2241 | 2432 | |
2242 | 2433 | $newPageSet = ( ! isset($param['pageset']) || $param['pageset'] != 'old'); |
2243 | 2434 | |
@@ -2254,12 +2445,22 @@ discard block |
||
2254 | 2445 | $orientation = ''; |
2255 | 2446 | if (isset($param['orientation'])) { |
2256 | 2447 | $param['orientation'] = strtolower($param['orientation']); |
2257 | - if ($param['orientation'] == 'p') $orientation = 'P'; |
|
2258 | - if ($param['orientation'] == 'portrait') $orientation = 'P'; |
|
2448 | + if ($param['orientation'] == 'p') { |
|
2449 | + $orientation = 'P'; |
|
2450 | + } |
|
2451 | + if ($param['orientation'] == 'portrait') { |
|
2452 | + $orientation = 'P'; |
|
2453 | + } |
|
2259 | 2454 | |
2260 | - if ($param['orientation'] == 'l') $orientation = 'L'; |
|
2261 | - if ($param['orientation'] == 'paysage') $orientation = 'L'; |
|
2262 | - 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 | + } |
|
2263 | 2464 | } |
2264 | 2465 | |
2265 | 2466 | // format |
@@ -2283,12 +2484,24 @@ discard block |
||
2283 | 2484 | $background['img'] = str_replace('&', '&', $background['img']); |
2284 | 2485 | |
2285 | 2486 | // convert the positions |
2286 | - if ($background['posX'] == 'left') $background['posX'] = '0%'; |
|
2287 | - if ($background['posX'] == 'center') $background['posX'] = '50%'; |
|
2288 | - if ($background['posX'] == 'right') $background['posX'] = '100%'; |
|
2289 | - if ($background['posY'] == 'top') $background['posY'] = '0%'; |
|
2290 | - if ($background['posY'] == 'middle') $background['posY'] = '50%'; |
|
2291 | - 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 | + } |
|
2292 | 2505 | |
2293 | 2506 | if ($background['img']) { |
2294 | 2507 | // get the size of the image |
@@ -2338,7 +2551,9 @@ discard block |
||
2338 | 2551 | // get the background color |
2339 | 2552 | $res = false; |
2340 | 2553 | $background['color'] = isset($param['backcolor']) ? $this->parsingCss->convertToColor($param['backcolor'], $res) : null; |
2341 | - if ( ! $res) $background['color'] = null; |
|
2554 | + if ( ! $res) { |
|
2555 | + $background['color'] = null; |
|
2556 | + } |
|
2342 | 2557 | |
2343 | 2558 | $this->parsingCss->save(); |
2344 | 2559 | $this->parsingCss->analyse('PAGE', $param); |
@@ -2412,14 +2627,20 @@ discard block |
||
2412 | 2627 | */ |
2413 | 2628 | protected function _tag_open_PAGE_HEADER($param) |
2414 | 2629 | { |
2415 | - if ($this->_isForOneLine) return false; |
|
2630 | + if ($this->_isForOneLine) { |
|
2631 | + return false; |
|
2632 | + } |
|
2416 | 2633 | |
2417 | 2634 | $this->_subHEADER = array(); |
2418 | 2635 | for ($this->_parsePos; $this->_parsePos < count($this->parsingHtml->code); $this->_parsePos++) { |
2419 | 2636 | $action = $this->parsingHtml->code[$this->_parsePos]; |
2420 | - if ($action['name'] == 'page_header') $action['name'] = 'page_header_sub'; |
|
2637 | + if ($action['name'] == 'page_header') { |
|
2638 | + $action['name'] = 'page_header_sub'; |
|
2639 | + } |
|
2421 | 2640 | $this->_subHEADER[] = $action; |
2422 | - if (strtolower($action['name']) == 'page_header_sub' && $action['close']) break; |
|
2641 | + if (strtolower($action['name']) == 'page_header_sub' && $action['close']) { |
|
2642 | + break; |
|
2643 | + } |
|
2423 | 2644 | } |
2424 | 2645 | |
2425 | 2646 | $this->_setPageHeader(); |
@@ -2436,14 +2657,20 @@ discard block |
||
2436 | 2657 | */ |
2437 | 2658 | protected function _tag_open_PAGE_FOOTER($param) |
2438 | 2659 | { |
2439 | - if ($this->_isForOneLine) return false; |
|
2660 | + if ($this->_isForOneLine) { |
|
2661 | + return false; |
|
2662 | + } |
|
2440 | 2663 | |
2441 | 2664 | $this->_subFOOTER = array(); |
2442 | 2665 | for ($this->_parsePos; $this->_parsePos < count($this->parsingHtml->code); $this->_parsePos++) { |
2443 | 2666 | $action = $this->parsingHtml->code[$this->_parsePos]; |
2444 | - if ($action['name'] == 'page_footer') $action['name'] = 'page_footer_sub'; |
|
2667 | + if ($action['name'] == 'page_footer') { |
|
2668 | + $action['name'] = 'page_footer_sub'; |
|
2669 | + } |
|
2445 | 2670 | $this->_subFOOTER[] = $action; |
2446 | - if (strtolower($action['name']) == 'page_footer_sub' && $action['close']) break; |
|
2671 | + if (strtolower($action['name']) == 'page_footer_sub' && $action['close']) { |
|
2672 | + break; |
|
2673 | + } |
|
2447 | 2674 | } |
2448 | 2675 | |
2449 | 2676 | $this->_setPageFooter(); |
@@ -2796,22 +3023,27 @@ discard block |
||
2796 | 3023 | if ( |
2797 | 3024 | $w < ($this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin()) && |
2798 | 3025 | $this->pdf->getX() + $w >= ($this->pdf->getW() - $this->pdf->getrMargin()) |
2799 | - ) |
|
2800 | - $this->_tag_open_BR(array()); |
|
3026 | + ) { |
|
3027 | + $this->_tag_open_BR(array()); |
|
3028 | + } |
|
2801 | 3029 | |
2802 | 3030 | if ( |
2803 | 3031 | ($h < ($this->pdf->getH() - $this->pdf->gettMargin() - $this->pdf->getbMargin())) && |
2804 | 3032 | ($this->pdf->getY() + $h >= ($this->pdf->getH() - $this->pdf->getbMargin())) && |
2805 | 3033 | ! $this->_isInOverflow |
2806 | - ) |
|
2807 | - $this->_setNewPage(); |
|
3034 | + ) { |
|
3035 | + $this->_setNewPage(); |
|
3036 | + } |
|
2808 | 3037 | |
2809 | 3038 | $old = $this->parsingCss->getOldValues(); |
2810 | 3039 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
2811 | 3040 | |
2812 | 3041 | if ($parentWidth > $w) { |
2813 | - if ($alignObject == 'center') $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5); |
|
2814 | - 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 | + } |
|
2815 | 3047 | } |
2816 | 3048 | |
2817 | 3049 | $this->parsingCss->setPosition(); |
@@ -2820,8 +3052,11 @@ discard block |
||
2820 | 3052 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
2821 | 3053 | |
2822 | 3054 | if ($parentWidth > $w) { |
2823 | - if ($alignObject == 'center') $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5); |
|
2824 | - 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 | + } |
|
2825 | 3060 | } |
2826 | 3061 | |
2827 | 3062 | $this->parsingCss->setPosition(); |
@@ -2870,7 +3105,9 @@ discard block |
||
2870 | 3105 | $xCorr = ($this->parsingCss->value['width'] - $wReel) * 0.5; |
2871 | 3106 | break; |
2872 | 3107 | } |
2873 | - if ($xCorr > 0) $xCorr = 0; |
|
3108 | + if ($xCorr > 0) { |
|
3109 | + $xCorr = 0; |
|
3110 | + } |
|
2874 | 3111 | switch ($this->parsingCss->value['vertical-align']) |
2875 | 3112 | { |
2876 | 3113 | case 'bottom': |
@@ -2954,7 +3191,9 @@ discard block |
||
2954 | 3191 | // get height of LEGEND element and make fieldset corrections |
2955 | 3192 | for ($tempPos = $this->_parsePos + 1; $tempPos < count($this->parsingHtml->code); $tempPos++) { |
2956 | 3193 | $action = $this->parsingHtml->code[$tempPos]; |
2957 | - if ($action['name'] == 'fieldset') break; |
|
3194 | + if ($action['name'] == 'fieldset') { |
|
3195 | + break; |
|
3196 | + } |
|
2958 | 3197 | if ($action['name'] == 'legend' && ! $action['close']) { |
2959 | 3198 | $legendOpenPos = $tempPos; |
2960 | 3199 | |
@@ -3120,16 +3359,27 @@ discard block |
||
3120 | 3359 | $lstBarcode['UPC_A'] = 'UPCA'; |
3121 | 3360 | $lstBarcode['CODE39'] = 'C39'; |
3122 | 3361 | |
3123 | - if ( ! isset($param['type'])) $param['type'] = 'C39'; |
|
3124 | - if ( ! isset($param['value'])) $param['value'] = 0; |
|
3125 | - if ( ! isset($param['label'])) $param['label'] = 'label'; |
|
3126 | - 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 | + } |
|
3127 | 3374 | |
3128 | - if ($this->_testIsDeprecated && (isset($param['bar_h']) || isset($param['bar_w']))) |
|
3129 | - 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 | + } |
|
3130 | 3378 | |
3131 | 3379 | $param['type'] = strtoupper($param['type']); |
3132 | - if (isset($lstBarcode[$param['type']])) $param['type'] = $lstBarcode[$param['type']]; |
|
3380 | + if (isset($lstBarcode[$param['type']])) { |
|
3381 | + $param['type'] = $lstBarcode[$param['type']]; |
|
3382 | + } |
|
3133 | 3383 | |
3134 | 3384 | $this->parsingCss->save(); |
3135 | 3385 | $this->parsingCss->analyse('barcode', $param); |
@@ -3138,8 +3388,12 @@ discard block |
||
3138 | 3388 | |
3139 | 3389 | $x = $this->pdf->getX(); |
3140 | 3390 | $y = $this->pdf->getY(); |
3141 | - $w = $this->parsingCss->value['width']; if ( ! $w) $w = $this->parsingCss->ConvertToMM('50mm'); |
|
3142 | - $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 | + } |
|
3143 | 3397 | $txt = ($param['label'] !== 'none' ? $this->parsingCss->value['font-size'] : false); |
3144 | 3398 | $c = $this->parsingCss->value['color']; |
3145 | 3399 | $infos = $this->pdf->myBarcode($param['value'], $param['type'], $x, $y, $w, $h, $txt, $c); |
@@ -3180,15 +3434,26 @@ discard block |
||
3180 | 3434 | */ |
3181 | 3435 | protected function _tag_open_QRCODE($param) |
3182 | 3436 | { |
3183 | - if ($this->_testIsDeprecated && (isset($param['size']) || isset($param['noborder']))) |
|
3184 | - 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 | + } |
|
3185 | 3440 | |
3186 | - if ($this->_debugActif) $this->_DEBUG_add('QRCODE'); |
|
3441 | + if ($this->_debugActif) { |
|
3442 | + $this->_DEBUG_add('QRCODE'); |
|
3443 | + } |
|
3187 | 3444 | |
3188 | - if ( ! isset($param['value'])) $param['value'] = ''; |
|
3189 | - if ( ! isset($param['ec'])) $param['ec'] = 'H'; |
|
3190 | - if ( ! isset($param['style']['color'])) $param['style']['color'] = '#000000'; |
|
3191 | - 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 | + } |
|
3192 | 3457 | if (isset($param['style']['border'])) { |
3193 | 3458 | $borders = $param['style']['border'] != 'none'; |
3194 | 3459 | unset($param['style']['border']); |
@@ -3196,8 +3461,12 @@ discard block |
||
3196 | 3461 | $borders = true; |
3197 | 3462 | } |
3198 | 3463 | |
3199 | - if ($param['value'] === '') return true; |
|
3200 | - 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 | + } |
|
3201 | 3470 | |
3202 | 3471 | $this->parsingCss->save(); |
3203 | 3472 | $this->parsingCss->analyse('qrcode', $param); |
@@ -3208,7 +3477,9 @@ discard block |
||
3208 | 3477 | $y = $this->pdf->getY(); |
3209 | 3478 | $w = $this->parsingCss->value['width']; |
3210 | 3479 | $h = $this->parsingCss->value['height']; |
3211 | - $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 | + } |
|
3212 | 3483 | |
3213 | 3484 | $style = array( |
3214 | 3485 | 'fgcolor' => $this->parsingCss->value['color'], |
@@ -3266,8 +3537,12 @@ discard block |
||
3266 | 3537 | $titre = isset($param['title']) ? trim($param['title']) : ''; |
3267 | 3538 | $level = isset($param['level']) ? floor($param['level']) : 0; |
3268 | 3539 | |
3269 | - if ($level < 0) $level = 0; |
|
3270 | - 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 | + } |
|
3271 | 3546 | |
3272 | 3547 | return true; |
3273 | 3548 | } |
@@ -3311,12 +3586,13 @@ discard block |
||
3311 | 3586 | $txt = str_replace('[[page_cu]]', $this->pdf->getMyNumPage($this->_page), $txt); |
3312 | 3587 | |
3313 | 3588 | if ($this->parsingCss->value['text-transform'] != 'none') { |
3314 | - if ($this->parsingCss->value['text-transform'] == 'capitalize') |
|
3315 | - $txt = ucwords($txt); |
|
3316 | - else if ($this->parsingCss->value['text-transform'] == 'uppercase') |
|
3317 | - $txt = strtoupper($txt); |
|
3318 | - else if ($this->parsingCss->value['text-transform'] == 'lowercase') |
|
3319 | - $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 | + } |
|
3320 | 3596 | } |
3321 | 3597 | |
3322 | 3598 | // size of the text |
@@ -3372,7 +3648,9 @@ discard block |
||
3372 | 3648 | array_shift($words); |
3373 | 3649 | $old = $str; |
3374 | 3650 | |
3375 | - if ( ! count($words)) break; |
|
3651 | + if ( ! count($words)) { |
|
3652 | + break; |
|
3653 | + } |
|
3376 | 3654 | $str[0] .= ' '.$words[0][0]; |
3377 | 3655 | $str[1] += $space + $words[0][1]; |
3378 | 3656 | } |
@@ -3389,7 +3667,9 @@ discard block |
||
3389 | 3667 | |
3390 | 3668 | // write the extract sentence that fit on the page |
3391 | 3669 | $wc = ($align == 'L' ? $str[1] : $this->parsingCss->value['width']); |
3392 | - if ($right - $left < $wc) $wc = $right - $left; |
|
3670 | + if ($right - $left < $wc) { |
|
3671 | + $wc = $right - $left; |
|
3672 | + } |
|
3393 | 3673 | |
3394 | 3674 | if (strlen($str[0])) { |
3395 | 3675 | $this->pdf->setXY($this->pdf->getX(), $y + $dh + $dy); |
@@ -3410,7 +3690,9 @@ discard block |
||
3410 | 3690 | // if we have again words to write |
3411 | 3691 | if (count($words)) { |
3412 | 3692 | // remove the space at the end |
3413 | - if ($add) $w -= $space; |
|
3693 | + if ($add) { |
|
3694 | + $w -= $space; |
|
3695 | + } |
|
3414 | 3696 | |
3415 | 3697 | // if we don't add any word, and if the first word is empty => useless space to skip |
3416 | 3698 | if ( ! $add && $words[0][0] === '') { |
@@ -3445,7 +3727,9 @@ discard block |
||
3445 | 3727 | // if more than 10000 line => error |
3446 | 3728 | $nb++; |
3447 | 3729 | if ($nb > 10000) { |
3448 | - $txt = ''; foreach ($words as $k => $word) $txt .= ($k ? ' ' : '').$word[0]; |
|
3730 | + $txt = ''; foreach ($words as $k => $word) { |
|
3731 | + $txt .= ($k ? ' ' : '').$word[0]; |
|
3732 | + } |
|
3449 | 3733 | throw new HTML2PDF_exception(2, array($txt, $right - $left, $w)); |
3450 | 3734 | } |
3451 | 3735 | |
@@ -3456,7 +3740,9 @@ discard block |
||
3456 | 3740 | |
3457 | 3741 | // if we have words after automatic cut, it is because they fit on the line => we write the text |
3458 | 3742 | if (count($words)) { |
3459 | - $txt = ''; foreach ($words as $k => $word) $txt .= ($k ? ' ' : '').$word[0]; |
|
3743 | + $txt = ''; foreach ($words as $k => $word) { |
|
3744 | + $txt .= ($k ? ' ' : '').$word[0]; |
|
3745 | + } |
|
3460 | 3746 | $w += $this->pdf->getWordSpacing() * (count($words)); |
3461 | 3747 | $this->pdf->setXY($this->pdf->getX(), $y + $dh + $dy); |
3462 | 3748 | $this->pdf->Cell(($align == 'L' ? $w : $this->parsingCss->value['width']), $h, $txt, 0, 0, $align, $fill, $this->_isInLink); |
@@ -3484,11 +3770,15 @@ discard block |
||
3484 | 3770 | */ |
3485 | 3771 | protected function _tag_open_BR($param, $curr = null) |
3486 | 3772 | { |
3487 | - if ($this->_isForOneLine) return false; |
|
3773 | + if ($this->_isForOneLine) { |
|
3774 | + return false; |
|
3775 | + } |
|
3488 | 3776 | |
3489 | 3777 | $h = max($this->_maxH, $this->parsingCss->getLineHeight()); |
3490 | 3778 | |
3491 | - 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 | + } |
|
3492 | 3782 | |
3493 | 3783 | $this->_makeBreakLine($h, $curr); |
3494 | 3784 | |
@@ -3531,8 +3821,12 @@ discard block |
||
3531 | 3821 | $this->parsingCss->fontSet(); |
3532 | 3822 | |
3533 | 3823 | $h = $this->parsingCss->value['height']; |
3534 | - if ($h) $h -= $this->parsingCss->value['border']['t']['width'] + $this->parsingCss->value['border']['b']['width']; |
|
3535 | - 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 | + } |
|
3536 | 3830 | |
3537 | 3831 | $this->_drawRectangle($this->pdf->getX(), $this->pdf->getY(), $this->parsingCss->value['width'], $h, $this->parsingCss->value['border'], 0, 0, $this->parsingCss->value['background']); |
3538 | 3832 | $this->_maxH = $h; |
@@ -3868,7 +4162,9 @@ discard block |
||
3868 | 4162 | |
3869 | 4163 | if (isset($param['name'])) { |
3870 | 4164 | $name = $param['name']; |
3871 | - 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 | + } |
|
3872 | 4168 | |
3873 | 4169 | if ( ! $this->_lstAnchor[$name][1]) { |
3874 | 4170 | $this->_lstAnchor[$name][1] = true; |
@@ -3878,7 +4174,9 @@ discard block |
||
3878 | 4174 | |
3879 | 4175 | if (preg_match('/^#([^#]+)$/isU', $this->_isInLink, $match)) { |
3880 | 4176 | $name = $match[1]; |
3881 | - 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 | + } |
|
3882 | 4180 | |
3883 | 4181 | $this->_isInLink = $this->_lstAnchor[$name][0]; |
3884 | 4182 | } |
@@ -4182,10 +4480,14 @@ discard block |
||
4182 | 4480 | */ |
4183 | 4481 | protected function _tag_open_P($param) |
4184 | 4482 | { |
4185 | - if ($this->_isForOneLine) return false; |
|
4483 | + if ($this->_isForOneLine) { |
|
4484 | + return false; |
|
4485 | + } |
|
4186 | 4486 | |
4187 | 4487 | if ( ! in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) { |
4188 | - if ($this->_maxH) $this->_tag_open_BR(array()); |
|
4488 | + if ($this->_maxH) { |
|
4489 | + $this->_tag_open_BR(array()); |
|
4490 | + } |
|
4189 | 4491 | } |
4190 | 4492 | |
4191 | 4493 | $this->parsingCss->save(); |
@@ -4250,7 +4552,9 @@ discard block |
||
4250 | 4552 | */ |
4251 | 4553 | protected function _tag_open_PRE($param, $other = 'pre') |
4252 | 4554 | { |
4253 | - if ($other == 'pre' && $this->_maxH) $this->_tag_open_BR(array()); |
|
4555 | + if ($other == 'pre' && $this->_maxH) { |
|
4556 | + $this->_tag_open_BR(array()); |
|
4557 | + } |
|
4254 | 4558 | |
4255 | 4559 | $this->parsingCss->save(); |
4256 | 4560 | $this->parsingCss->value['font-family'] = 'courier'; |
@@ -4258,7 +4562,9 @@ discard block |
||
4258 | 4562 | $this->parsingCss->setPosition(); |
4259 | 4563 | $this->parsingCss->fontSet(); |
4260 | 4564 | |
4261 | - if ($other == 'pre') return $this->_tag_open_DIV($param, $other); |
|
4565 | + if ($other == 'pre') { |
|
4566 | + return $this->_tag_open_DIV($param, $other); |
|
4567 | + } |
|
4262 | 4568 | |
4263 | 4569 | return true; |
4264 | 4570 | } |
@@ -4286,7 +4592,9 @@ discard block |
||
4286 | 4592 | protected function _tag_close_PRE($param, $other = 'pre') |
4287 | 4593 | { |
4288 | 4594 | if ($other == 'pre') { |
4289 | - if ($this->_isForOneLine) return false; |
|
4595 | + if ($this->_isForOneLine) { |
|
4596 | + return false; |
|
4597 | + } |
|
4290 | 4598 | |
4291 | 4599 | $this->_tag_close_DIV($param, $other); |
4292 | 4600 | $this->_tag_open_BR(array()); |
@@ -4452,14 +4760,22 @@ discard block |
||
4452 | 4760 | */ |
4453 | 4761 | protected function _tag_open_UL($param, $other = 'ul') |
4454 | 4762 | { |
4455 | - if ($this->_isForOneLine) return false; |
|
4763 | + if ($this->_isForOneLine) { |
|
4764 | + return false; |
|
4765 | + } |
|
4456 | 4766 | |
4457 | 4767 | if ( ! in_array($this->_previousCall, array('_tag_close_P', '_tag_close_UL'))) { |
4458 | - if ($this->_maxH) $this->_tag_open_BR(array()); |
|
4459 | - if ( ! count($this->_defList)) $this->_tag_open_BR(array()); |
|
4768 | + if ($this->_maxH) { |
|
4769 | + $this->_tag_open_BR(array()); |
|
4770 | + } |
|
4771 | + if ( ! count($this->_defList)) { |
|
4772 | + $this->_tag_open_BR(array()); |
|
4773 | + } |
|
4460 | 4774 | } |
4461 | 4775 | |
4462 | - if ( ! isset($param['style']['width'])) $param['allwidth'] = true; |
|
4776 | + if ( ! isset($param['style']['width'])) { |
|
4777 | + $param['allwidth'] = true; |
|
4778 | + } |
|
4463 | 4779 | $param['cellspacing'] = 0; |
4464 | 4780 | |
4465 | 4781 | // a list is like a table |
@@ -4492,14 +4808,18 @@ discard block |
||
4492 | 4808 | */ |
4493 | 4809 | protected function _tag_close_UL($param) |
4494 | 4810 | { |
4495 | - if ($this->_isForOneLine) return false; |
|
4811 | + if ($this->_isForOneLine) { |
|
4812 | + return false; |
|
4813 | + } |
|
4496 | 4814 | |
4497 | 4815 | $this->_tag_close_TABLE($param); |
4498 | 4816 | |
4499 | 4817 | $this->_listeDelLevel(); |
4500 | 4818 | |
4501 | 4819 | if ( ! $this->_subPart) { |
4502 | - if ( ! count($this->_defList)) $this->_tag_open_BR(array()); |
|
4820 | + if ( ! count($this->_defList)) { |
|
4821 | + $this->_tag_open_BR(array()); |
|
4822 | + } |
|
4503 | 4823 | } |
4504 | 4824 | |
4505 | 4825 | return true; |
@@ -4526,11 +4846,15 @@ discard block |
||
4526 | 4846 | */ |
4527 | 4847 | protected function _tag_open_LI($param) |
4528 | 4848 | { |
4529 | - if ($this->_isForOneLine) return false; |
|
4849 | + if ($this->_isForOneLine) { |
|
4850 | + return false; |
|
4851 | + } |
|
4530 | 4852 | |
4531 | 4853 | $this->_listeAddLi(); |
4532 | 4854 | |
4533 | - if ( ! isset($param['style']['width'])) $param['style']['width'] = '100%'; |
|
4855 | + if ( ! isset($param['style']['width'])) { |
|
4856 | + $param['style']['width'] = '100%'; |
|
4857 | + } |
|
4534 | 4858 | |
4535 | 4859 | $paramPUCE = $param; |
4536 | 4860 | |
@@ -4684,9 +5008,13 @@ discard block |
||
4684 | 5008 | HTML2PDF::$_tables[$param['num']]['thead']['code'] = array(); |
4685 | 5009 | for ($pos = $this->_tempPos; $pos < count($this->parsingHtml->code); $pos++) { |
4686 | 5010 | $action = $this->parsingHtml->code[$pos]; |
4687 | - if (strtolower($action['name']) == 'thead') $action['name'] = 'thead_sub'; |
|
5011 | + if (strtolower($action['name']) == 'thead') { |
|
5012 | + $action['name'] = 'thead_sub'; |
|
5013 | + } |
|
4688 | 5014 | HTML2PDF::$_tables[$param['num']]['thead']['code'][] = $action; |
4689 | - if (strtolower($action['name']) == 'thead_sub' && $action['close']) break; |
|
5015 | + if (strtolower($action['name']) == 'thead_sub' && $action['close']) { |
|
5016 | + break; |
|
5017 | + } |
|
4690 | 5018 | } |
4691 | 5019 | } else { |
4692 | 5020 | $level = $this->parsingHtml->getLevel($this->_parsePos); |
@@ -4747,9 +5075,13 @@ discard block |
||
4747 | 5075 | HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array(); |
4748 | 5076 | for ($pos = $this->_tempPos; $pos < count($this->parsingHtml->code); $pos++) { |
4749 | 5077 | $action = $this->parsingHtml->code[$pos]; |
4750 | - if (strtolower($action['name']) == 'tfoot') $action['name'] = 'tfoot_sub'; |
|
5078 | + if (strtolower($action['name']) == 'tfoot') { |
|
5079 | + $action['name'] = 'tfoot_sub'; |
|
5080 | + } |
|
4751 | 5081 | HTML2PDF::$_tables[$param['num']]['tfoot']['code'][] = $action; |
4752 | - if (strtolower($action['name']) == 'tfoot_sub' && $action['close']) break; |
|
5082 | + if (strtolower($action['name']) == 'tfoot_sub' && $action['close']) { |
|
5083 | + break; |
|
5084 | + } |
|
4753 | 5085 | } |
4754 | 5086 | } else { |
4755 | 5087 | $level = $this->parsingHtml->getLevel($this->_parsePos); |
@@ -4930,15 +5262,21 @@ discard block |
||
4930 | 5262 | $this->_maxH = 0; |
4931 | 5263 | |
4932 | 5264 | $alignObject = isset($param['align']) ? strtolower($param['align']) : 'left'; |
4933 | - if (isset($param['align'])) unset($param['align']); |
|
4934 | - if ( ! in_array($alignObject, array('left', 'center', 'right'))) $alignObject = 'left'; |
|
5265 | + if (isset($param['align'])) { |
|
5266 | + unset($param['align']); |
|
5267 | + } |
|
5268 | + if ( ! in_array($alignObject, array('left', 'center', 'right'))) { |
|
5269 | + $alignObject = 'left'; |
|
5270 | + } |
|
4935 | 5271 | |
4936 | 5272 | $this->parsingCss->save(); |
4937 | 5273 | $this->parsingCss->analyse($other, $param); |
4938 | 5274 | $this->parsingCss->setPosition(); |
4939 | 5275 | $this->parsingCss->fontSet(); |
4940 | 5276 | |
4941 | - if ($this->parsingCss->value['margin-auto']) $alignObject = 'center'; |
|
5277 | + if ($this->parsingCss->value['margin-auto']) { |
|
5278 | + $alignObject = 'center'; |
|
5279 | + } |
|
4942 | 5280 | |
4943 | 5281 | // collapse table ? |
4944 | 5282 | $collapse = false; |
@@ -5051,9 +5389,10 @@ discard block |
||
5051 | 5389 | foreach (HTML2PDF::$_tables[$param['num']][$mode]['tr'] as $tr) { |
5052 | 5390 | // hauteur de la ligne tr |
5053 | 5391 | $h = 0; |
5054 | - for ($i = 0; $i < count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++) |
|
5055 | - if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan'] == 1) |
|
5392 | + for ($i = 0; $i < count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++) { |
|
5393 | + if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan'] == 1) |
|
5056 | 5394 | $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['h']); |
5395 | + } |
|
5057 | 5396 | HTML2PDF::$_tables[$param['num']][$mode]['height'] += $h; |
5058 | 5397 | } |
5059 | 5398 | } |
@@ -5072,10 +5411,11 @@ discard block |
||
5072 | 5411 | $x = HTML2PDF::$_tables[$param['num']]['curr_x']; |
5073 | 5412 | $w = HTML2PDF::$_tables[$param['num']]['width']; |
5074 | 5413 | if ($parentWidth > $w) { |
5075 | - if (HTML2PDF::$_tables[$param['num']]['align'] == 'center') |
|
5076 | - $x = $x + ($parentWidth - $w) * 0.5; |
|
5077 | - else if (HTML2PDF::$_tables[$param['num']]['align'] == 'right') |
|
5078 | - $x = $x + $parentWidth - $w; |
|
5414 | + if (HTML2PDF::$_tables[$param['num']]['align'] == 'center') { |
|
5415 | + $x = $x + ($parentWidth - $w) * 0.5; |
|
5416 | + } else if (HTML2PDF::$_tables[$param['num']]['align'] == 'right') { |
|
5417 | + $x = $x + $parentWidth - $w; |
|
5418 | + } |
|
5079 | 5419 | |
5080 | 5420 | HTML2PDF::$_tables[$param['num']]['curr_x'] = $x; |
5081 | 5421 | } |
@@ -5111,13 +5451,16 @@ discard block |
||
5111 | 5451 | for ($i = 0; $i < count(HTML2PDF::$_tables[$param['num']]['cases'][$k]); $i++) { |
5112 | 5452 | $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']); |
5113 | 5453 | |
5114 | - if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan'] == 1) |
|
5115 | - $th = max($th, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']); |
|
5454 | + if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan'] == 1) { |
|
5455 | + $th = max($th, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']); |
|
5456 | + } |
|
5116 | 5457 | } |
5117 | 5458 | |
5118 | 5459 | // if the row does not fit on the page => new page |
5119 | 5460 | if ($y + $h + $height > $max) { |
5120 | - if ($height == $h0) $height = null; |
|
5461 | + if ($height == $h0) { |
|
5462 | + $height = null; |
|
5463 | + } |
|
5121 | 5464 | HTML2PDF::$_tables[$param['num']]['height'][] = $height; |
5122 | 5465 | $height = $h0; |
5123 | 5466 | $y = $this->_margeTop; |
@@ -5126,7 +5469,9 @@ discard block |
||
5126 | 5469 | } |
5127 | 5470 | |
5128 | 5471 | // if ther is a height at the end, add it |
5129 | - if ($height != $h0 || $k == 0) HTML2PDF::$_tables[$param['num']]['height'][] = $height; |
|
5472 | + if ($height != $h0 || $k == 0) { |
|
5473 | + HTML2PDF::$_tables[$param['num']]['height'][] = $height; |
|
5474 | + } |
|
5130 | 5475 | } else { |
5131 | 5476 | // if we have tfoor, draw it |
5132 | 5477 | if (count(HTML2PDF::$_tables[$param['num']]['tfoot']['code'])) { |
@@ -5151,12 +5496,13 @@ discard block |
||
5151 | 5496 | |
5152 | 5497 | // get the positions of the end of the table |
5153 | 5498 | $x = HTML2PDF::$_tables[$param['num']]['curr_x'] + HTML2PDF::$_tables[$param['num']]['width']; |
5154 | - if (count(HTML2PDF::$_tables[$param['num']]['height']) > 1) |
|
5155 | - $y = $this->_margeTop + HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height']) - 1]; |
|
5156 | - else if (count(HTML2PDF::$_tables[$param['num']]['height']) == 1) |
|
5157 | - $y = HTML2PDF::$_tables[$param['num']]['curr_y'] + HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height']) - 1]; |
|
5158 | - else |
|
5159 | - $y = HTML2PDF::$_tables[$param['num']]['curr_y']; |
|
5499 | + if (count(HTML2PDF::$_tables[$param['num']]['height']) > 1) { |
|
5500 | + $y = $this->_margeTop + HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height']) - 1]; |
|
5501 | + } else if (count(HTML2PDF::$_tables[$param['num']]['height']) == 1) { |
|
5502 | + $y = HTML2PDF::$_tables[$param['num']]['curr_y'] + HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height']) - 1]; |
|
5503 | + } else { |
|
5504 | + $y = HTML2PDF::$_tables[$param['num']]['curr_y']; |
|
5505 | + } |
|
5160 | 5506 | |
5161 | 5507 | $this->_maxX = max($this->_maxX, $x); |
5162 | 5508 | $this->_maxY = max($this->_maxY, $y); |
@@ -5187,8 +5533,9 @@ discard block |
||
5187 | 5533 | protected function _tag_open_COL($param) |
5188 | 5534 | { |
5189 | 5535 | $span = isset($param['span']) ? $param['span'] : 1; |
5190 | - for ($k = 0; $k < $span; $k++) |
|
5191 | - HTML2PDF::$_tables[$param['num']]['cols'][] = $param; |
|
5536 | + for ($k = 0; $k < $span; $k++) { |
|
5537 | + HTML2PDF::$_tables[$param['num']]['cols'][] = $param; |
|
5538 | + } |
|
5192 | 5539 | } |
5193 | 5540 | |
5194 | 5541 | /** |
@@ -5320,12 +5667,14 @@ discard block |
||
5320 | 5667 | } else { |
5321 | 5668 | // prepare it |
5322 | 5669 | HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr'] - 1] = array(); |
5323 | - if ( ! isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']])) |
|
5324 | - HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']] = array(); |
|
5670 | + if ( ! isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']])) { |
|
5671 | + HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']] = array(); |
|
5672 | + } |
|
5325 | 5673 | |
5326 | 5674 | HTML2PDF::$_tables[$param['num']]['corr_x'] = 0; |
5327 | - while (isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']])) |
|
5328 | - HTML2PDF::$_tables[$param['num']]['corr_x']++; |
|
5675 | + while (isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']])) { |
|
5676 | + HTML2PDF::$_tables[$param['num']]['corr_x']++; |
|
5677 | + } |
|
5329 | 5678 | } |
5330 | 5679 | |
5331 | 5680 | return true; |
@@ -5437,10 +5786,11 @@ discard block |
||
5437 | 5786 | if (count($colParam['style']['width'])) { |
5438 | 5787 | $total = $colParam['style']['width'][0]; unset($colParam['style']['width'][0]); |
5439 | 5788 | foreach ($colParam['style']['width'] as $width) { |
5440 | - if (substr($total, -1) == '%' && substr($width, -1) == '%') |
|
5441 | - $total = (str_replace('%', '', $total) + str_replace('%', '', $width)).'%'; |
|
5442 | - else |
|
5443 | - $total = ($this->parsingCss->ConvertToMM($total, $last) + $this->parsingCss->ConvertToMM($width, $last)).'mm'; |
|
5789 | + if (substr($total, -1) == '%' && substr($width, -1) == '%') { |
|
5790 | + $total = (str_replace('%', '', $total) + str_replace('%', '', $width)).'%'; |
|
5791 | + } else { |
|
5792 | + $total = ($this->parsingCss->ConvertToMM($total, $last) + $this->parsingCss->ConvertToMM($width, $last)).'mm'; |
|
5793 | + } |
|
5444 | 5794 | } |
5445 | 5795 | } |
5446 | 5796 | |
@@ -5505,7 +5855,9 @@ discard block |
||
5505 | 5855 | } |
5506 | 5856 | |
5507 | 5857 | if (HTML2PDF::$_tables[$param['num']]['td_curr'] > 0) { |
5508 | - if ( ! $return) $this->parsingCss->value['width'] += $this->parsingCss->value['border']['l']['width']; |
|
5858 | + if ( ! $return) { |
|
5859 | + $this->parsingCss->value['width'] += $this->parsingCss->value['border']['l']['width']; |
|
5860 | + } |
|
5509 | 5861 | $this->parsingCss->value['border']['l'] = $this->parsingCss->readBorder('none'); |
5510 | 5862 | } |
5511 | 5863 | } |
@@ -5729,7 +6081,9 @@ discard block |
||
5729 | 6081 | $this->parsingCss->fontSet(); |
5730 | 6082 | |
5731 | 6083 | $res = $this->_drawImage($src, isset($param['sub_li'])); |
5732 | - if ( ! $res) return $res; |
|
6084 | + if ( ! $res) { |
|
6085 | + return $res; |
|
6086 | + } |
|
5733 | 6087 | |
5734 | 6088 | $this->parsingCss->load(); |
5735 | 6089 | $this->parsingCss->fontSet(); |
@@ -5770,7 +6124,9 @@ discard block |
||
5770 | 6124 | $this->_lstSelect['size'] = isset($param['size']) ? $param['size'] : 1; |
5771 | 6125 | $this->_lstSelect['options'] = array(); |
5772 | 6126 | |
5773 | - if ($this->_lstSelect['multi'] && $this->_lstSelect['size'] < 3) $this->_lstSelect['size'] = 3; |
|
6127 | + if ($this->_lstSelect['multi'] && $this->_lstSelect['size'] < 3) { |
|
6128 | + $this->_lstSelect['size'] = 3; |
|
6129 | + } |
|
5774 | 6130 | |
5775 | 6131 | return true; |
5776 | 6132 | } |
@@ -5822,7 +6178,9 @@ discard block |
||
5822 | 6178 | $f = 1.08 * $this->parsingCss->value['font-size']; |
5823 | 6179 | |
5824 | 6180 | // width |
5825 | - $w = $this->parsingCss->value['width']; if ( ! $w) $w = 50; |
|
6181 | + $w = $this->parsingCss->value['width']; if ( ! $w) { |
|
6182 | + $w = 50; |
|
6183 | + } |
|
5826 | 6184 | |
5827 | 6185 | // height (automatic) |
5828 | 6186 | $h = ($f * 1.07 * $this->_lstSelect['size'] + 1); |
@@ -5934,9 +6292,15 @@ discard block |
||
5934 | 6292 | */ |
5935 | 6293 | protected function _tag_open_INPUT($param) |
5936 | 6294 | { |
5937 | - if ( ! isset($param['name'])) $param['name'] = 'champs_pdf_'.(count($this->_lstField) + 1); |
|
5938 | - if ( ! isset($param['value'])) $param['value'] = ''; |
|
5939 | - if ( ! isset($param['type'])) $param['type'] = 'text'; |
|
6295 | + if ( ! isset($param['name'])) { |
|
6296 | + $param['name'] = 'champs_pdf_'.(count($this->_lstField) + 1); |
|
6297 | + } |
|
6298 | + if ( ! isset($param['value'])) { |
|
6299 | + $param['value'] = ''; |
|
6300 | + } |
|
6301 | + if ( ! isset($param['type'])) { |
|
6302 | + $param['type'] = 'text'; |
|
6303 | + } |
|
5940 | 6304 | |
5941 | 6305 | $param['name'] = strtolower($param['name']); |
5942 | 6306 | $param['type'] = strtolower($param['type']); |
@@ -5970,7 +6334,9 @@ discard block |
||
5970 | 6334 | case 'checkbox': |
5971 | 6335 | $w = 3; |
5972 | 6336 | $h = $w; |
5973 | - if ($h < $f) $y += ($f - $h) * 0.5; |
|
6337 | + if ($h < $f) { |
|
6338 | + $y += ($f - $h) * 0.5; |
|
6339 | + } |
|
5974 | 6340 | $checked = (isset($param['checked']) && $param['checked'] == 'checked'); |
5975 | 6341 | $this->pdf->CheckBox($name, $w, $checked, $prop, array(), ($param['value'] ? $param['value'] : 'Yes'), $x, $y); |
5976 | 6342 | break; |
@@ -5978,7 +6344,9 @@ discard block |
||
5978 | 6344 | case 'radio': |
5979 | 6345 | $w = 3; |
5980 | 6346 | $h = $w; |
5981 | - if ($h < $f) $y += ($f - $h) * 0.5; |
|
6347 | + if ($h < $f) { |
|
6348 | + $y += ($f - $h) * 0.5; |
|
6349 | + } |
|
5982 | 6350 | $checked = (isset($param['checked']) && $param['checked'] == 'checked'); |
5983 | 6351 | $this->pdf->RadioButton($name, $w, $prop, array(), ($param['value'] ? $param['value'] : 'On'), $checked, $x, $y); |
5984 | 6352 | break; |
@@ -5991,29 +6359,43 @@ discard block |
||
5991 | 6359 | break; |
5992 | 6360 | |
5993 | 6361 | case 'text': |
5994 | - $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40; |
|
6362 | + $w = $this->parsingCss->value['width']; if ( ! $w) { |
|
6363 | + $w = 40; |
|
6364 | + } |
|
5995 | 6365 | $h = $f * 1.3; |
5996 | 6366 | $prop['value'] = $param['value']; |
5997 | 6367 | $this->pdf->TextField($name, $w, $h, $prop, array(), $x, $y); |
5998 | 6368 | break; |
5999 | 6369 | |
6000 | 6370 | case 'submit': |
6001 | - $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40; |
|
6002 | - $h = $this->parsingCss->value['height']; if ( ! $h) $h = $f * 1.3; |
|
6371 | + $w = $this->parsingCss->value['width']; if ( ! $w) { |
|
6372 | + $w = 40; |
|
6373 | + } |
|
6374 | + $h = $this->parsingCss->value['height']; if ( ! $h) { |
|
6375 | + $h = $f * 1.3; |
|
6376 | + } |
|
6003 | 6377 | $action = array('S'=>'SubmitForm', 'F'=>$this->_isInForm, 'Flags'=>array('ExportFormat')); |
6004 | 6378 | $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y); |
6005 | 6379 | break; |
6006 | 6380 | |
6007 | 6381 | case 'reset': |
6008 | - $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40; |
|
6009 | - $h = $this->parsingCss->value['height']; if ( ! $h) $h = $f * 1.3; |
|
6382 | + $w = $this->parsingCss->value['width']; if ( ! $w) { |
|
6383 | + $w = 40; |
|
6384 | + } |
|
6385 | + $h = $this->parsingCss->value['height']; if ( ! $h) { |
|
6386 | + $h = $f * 1.3; |
|
6387 | + } |
|
6010 | 6388 | $action = array('S'=>'ResetForm'); |
6011 | 6389 | $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y); |
6012 | 6390 | break; |
6013 | 6391 | |
6014 | 6392 | case 'button': |
6015 | - $w = $this->parsingCss->value['width']; if ( ! $w) $w = 40; |
|
6016 | - $h = $this->parsingCss->value['height']; if ( ! $h) $h = $f * 1.3; |
|
6393 | + $w = $this->parsingCss->value['width']; if ( ! $w) { |
|
6394 | + $w = 40; |
|
6395 | + } |
|
6396 | + $h = $this->parsingCss->value['height']; if ( ! $h) { |
|
6397 | + $h = $f * 1.3; |
|
6398 | + } |
|
6017 | 6399 | $action = isset($param['onclick']) ? $param['onclick'] : ''; |
6018 | 6400 | $this->pdf->Button($name, $w, $h, $param['value'], $action, $prop, array(), $x, $y); |
6019 | 6401 | break; |
@@ -6074,22 +6456,27 @@ discard block |
||
6074 | 6456 | if ( |
6075 | 6457 | $w < ($this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin()) && |
6076 | 6458 | $this->pdf->getX() + $w >= ($this->pdf->getW() - $this->pdf->getrMargin()) |
6077 | - ) |
|
6078 | - $this->_tag_open_BR(array()); |
|
6459 | + ) { |
|
6460 | + $this->_tag_open_BR(array()); |
|
6461 | + } |
|
6079 | 6462 | |
6080 | 6463 | if ( |
6081 | 6464 | ($h < ($this->pdf->getH() - $this->pdf->gettMargin() - $this->pdf->getbMargin())) && |
6082 | 6465 | ($this->pdf->getY() + $h >= ($this->pdf->getH() - $this->pdf->getbMargin())) && |
6083 | 6466 | ! $this->_isInOverflow |
6084 | - ) |
|
6085 | - $this->_setNewPage(); |
|
6467 | + ) { |
|
6468 | + $this->_setNewPage(); |
|
6469 | + } |
|
6086 | 6470 | |
6087 | 6471 | $old = $this->parsingCss->getOldValues(); |
6088 | 6472 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
6089 | 6473 | |
6090 | 6474 | if ($parentWidth > $w) { |
6091 | - if ($alignObject == 'center') $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5); |
|
6092 | - else if ($alignObject == 'right') $this->pdf->setX($this->pdf->getX() + $parentWidth - $w); |
|
6475 | + if ($alignObject == 'center') { |
|
6476 | + $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5); |
|
6477 | + } else if ($alignObject == 'right') { |
|
6478 | + $this->pdf->setX($this->pdf->getX() + $parentWidth - $w); |
|
6479 | + } |
|
6093 | 6480 | } |
6094 | 6481 | |
6095 | 6482 | $this->parsingCss->setPosition(); |
@@ -6098,8 +6485,11 @@ discard block |
||
6098 | 6485 | $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin(); |
6099 | 6486 | |
6100 | 6487 | if ($parentWidth > $w) { |
6101 | - if ($alignObject == 'center') $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5); |
|
6102 | - else if ($alignObject == 'right') $this->pdf->setX($this->pdf->getX() + $parentWidth - $w); |
|
6488 | + if ($alignObject == 'center') { |
|
6489 | + $this->pdf->setX($this->pdf->getX() + ($parentWidth - $w) * 0.5); |
|
6490 | + } else if ($alignObject == 'right') { |
|
6491 | + $this->pdf->setX($this->pdf->getX() + $parentWidth - $w); |
|
6492 | + } |
|
6103 | 6493 | } |
6104 | 6494 | |
6105 | 6495 | $this->parsingCss->setPosition(); |
@@ -6240,7 +6630,9 @@ discard block |
||
6240 | 6630 | */ |
6241 | 6631 | protected function _tag_open_LINE($param) |
6242 | 6632 | { |
6243 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'LINE'); |
|
6633 | + if ( ! $this->_isInDraw) { |
|
6634 | + throw new HTML2PDF_exception(8, 'LINE'); |
|
6635 | + } |
|
6244 | 6636 | |
6245 | 6637 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6246 | 6638 | $this->parsingCss->save(); |
@@ -6267,7 +6659,9 @@ discard block |
||
6267 | 6659 | */ |
6268 | 6660 | protected function _tag_open_RECT($param) |
6269 | 6661 | { |
6270 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'RECT'); |
|
6662 | + if ( ! $this->_isInDraw) { |
|
6663 | + throw new HTML2PDF_exception(8, 'RECT'); |
|
6664 | + } |
|
6271 | 6665 | |
6272 | 6666 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6273 | 6667 | $this->parsingCss->save(); |
@@ -6294,7 +6688,9 @@ discard block |
||
6294 | 6688 | */ |
6295 | 6689 | protected function _tag_open_CIRCLE($param) |
6296 | 6690 | { |
6297 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'CIRCLE'); |
|
6691 | + if ( ! $this->_isInDraw) { |
|
6692 | + throw new HTML2PDF_exception(8, 'CIRCLE'); |
|
6693 | + } |
|
6298 | 6694 | |
6299 | 6695 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6300 | 6696 | $this->parsingCss->save(); |
@@ -6319,7 +6715,9 @@ discard block |
||
6319 | 6715 | */ |
6320 | 6716 | protected function _tag_open_ELLIPSE($param) |
6321 | 6717 | { |
6322 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'ELLIPSE'); |
|
6718 | + if ( ! $this->_isInDraw) { |
|
6719 | + throw new HTML2PDF_exception(8, 'ELLIPSE'); |
|
6720 | + } |
|
6323 | 6721 | |
6324 | 6722 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6325 | 6723 | $this->parsingCss->save(); |
@@ -6346,7 +6744,9 @@ discard block |
||
6346 | 6744 | */ |
6347 | 6745 | protected function _tag_open_POLYLINE($param) |
6348 | 6746 | { |
6349 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6747 | + if ( ! $this->_isInDraw) { |
|
6748 | + throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6749 | + } |
|
6350 | 6750 | |
6351 | 6751 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6352 | 6752 | $this->parsingCss->save(); |
@@ -6362,7 +6762,9 @@ discard block |
||
6362 | 6762 | $path = explode(' ', $path); |
6363 | 6763 | foreach ($path as $k => $v) { |
6364 | 6764 | $path[$k] = trim($v); |
6365 | - if ($path[$k] === '') unset($path[$k]); |
|
6765 | + if ($path[$k] === '') { |
|
6766 | + unset($path[$k]); |
|
6767 | + } |
|
6366 | 6768 | } |
6367 | 6769 | $path = array_values($path); |
6368 | 6770 | |
@@ -6392,7 +6794,9 @@ discard block |
||
6392 | 6794 | */ |
6393 | 6795 | protected function _tag_open_POLYGON($param) |
6394 | 6796 | { |
6395 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6797 | + if ( ! $this->_isInDraw) { |
|
6798 | + throw new HTML2PDF_exception(8, 'POLYGON'); |
|
6799 | + } |
|
6396 | 6800 | |
6397 | 6801 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6398 | 6802 | $this->parsingCss->save(); |
@@ -6408,7 +6812,9 @@ discard block |
||
6408 | 6812 | $path = explode(' ', $path); |
6409 | 6813 | foreach ($path as $k => $v) { |
6410 | 6814 | $path[$k] = trim($v); |
6411 | - if ($path[$k] === '') unset($path[$k]); |
|
6815 | + if ($path[$k] === '') { |
|
6816 | + unset($path[$k]); |
|
6817 | + } |
|
6412 | 6818 | } |
6413 | 6819 | $path = array_values($path); |
6414 | 6820 | |
@@ -6439,7 +6845,9 @@ discard block |
||
6439 | 6845 | */ |
6440 | 6846 | protected function _tag_open_PATH($param) |
6441 | 6847 | { |
6442 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'PATH'); |
|
6848 | + if ( ! $this->_isInDraw) { |
|
6849 | + throw new HTML2PDF_exception(8, 'PATH'); |
|
6850 | + } |
|
6443 | 6851 | |
6444 | 6852 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6445 | 6853 | $this->parsingCss->save(); |
@@ -6459,7 +6867,9 @@ discard block |
||
6459 | 6867 | $path = explode(' ', $path); |
6460 | 6868 | foreach ($path as $k => $v) { |
6461 | 6869 | $path[$k] = trim($v); |
6462 | - if ($path[$k] === '') unset($path[$k]); |
|
6870 | + if ($path[$k] === '') { |
|
6871 | + unset($path[$k]); |
|
6872 | + } |
|
6463 | 6873 | } |
6464 | 6874 | $path = array_values($path); |
6465 | 6875 | |
@@ -6568,7 +6978,9 @@ discard block |
||
6568 | 6978 | */ |
6569 | 6979 | protected function _tag_open_G($param) |
6570 | 6980 | { |
6571 | - if ( ! $this->_isInDraw) throw new HTML2PDF_exception(8, 'G'); |
|
6981 | + if ( ! $this->_isInDraw) { |
|
6982 | + throw new HTML2PDF_exception(8, 'G'); |
|
6983 | + } |
|
6572 | 6984 | |
6573 | 6985 | $this->pdf->doTransform(isset($param['transform']) ? $this->_prepareTransform($param['transform']) : null); |
6574 | 6986 | $this->parsingCss->save(); |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | return $fp; |
45 | - } |
|
46 | - else { |
|
45 | + } else { |
|
47 | 46 | return false; |
48 | 47 | } |
49 | 48 | } |
@@ -86,8 +85,7 @@ discard block |
||
86 | 85 | } |
87 | 86 | |
88 | 87 | return $response; |
89 | - } |
|
90 | - else { |
|
88 | + } else { |
|
91 | 89 | // echo "no handle"; |
92 | 90 | } |
93 | 91 | } |