@@ -256,6 +256,7 @@ |
||
| 256 | 256 | //Insert callee cdr entry for DID calls |
| 257 | 257 | /** |
| 258 | 258 | * @param boolean $flag_parent |
| 259 | + * @param string $provider_cost |
|
| 259 | 260 | */ |
| 260 | 261 | function insert_extra_receiver_entry($dataVariable,$origination_rate,$termination_rate,$account_type,$actual_duration,$provider_cost,$parentid,$flag_parent,$accountid,$logger,$db,$decimal_points) |
| 261 | 262 | { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | if ($dataVariable['billsec'] == 0 && $dataVariable['hangup_cause'] == 'NORMAL_CLEARING') |
| 48 | 48 | { |
| 49 | 49 | $hangup_cause = isset($dataVariable['last_bridge_hangup_cause'])?$dataVariable['last_bridge_hangup_cause']:$dataVariable['hangup_cause']; |
| 50 | - }else{ |
|
| 50 | + } else{ |
|
| 51 | 51 | $hangup_cause = $dataVariable['hangup_cause']; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -86,10 +86,12 @@ discard block |
||
| 86 | 86 | $actual_calltype = $dataVariable['calltype']; |
| 87 | 87 | |
| 88 | 88 | //Normalize origination and termination rates array |
| 89 | - if(isset($dataVariable['origination_rates'])) |
|
| 90 | - $origination_rate = normalize_origination_rate($dataVariable['origination_rates']); |
|
| 91 | - if(isset($dataVariable['termination_rates'])) |
|
| 92 | - $termination_rate = normalize_rate($dataVariable['termination_rates']); |
|
| 89 | + if(isset($dataVariable['origination_rates'])) { |
|
| 90 | + $origination_rate = normalize_origination_rate($dataVariable['origination_rates']); |
|
| 91 | + } |
|
| 92 | + if(isset($dataVariable['termination_rates'])) { |
|
| 93 | + $termination_rate = normalize_rate($dataVariable['termination_rates']); |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | //If receiver account id found then explicitly set call direction and call type |
| 95 | 97 | if(isset($dataVariable['receiver_accid'])) |
@@ -441,11 +443,12 @@ discard block |
||
| 441 | 443 | $query_counter = "SELECT id,seconds FROM counters WHERE accountid = ".$accountid." AND package_id = ".$package_id." AND status=1 LIMIT 1"; |
| 442 | 444 | $counter = $db->run($query_counter); |
| 443 | 445 | $logger->log("GET Counters : " . $query_counter); |
| 444 | - if($counter) |
|
| 445 | - return $counter[0]; |
|
| 446 | - else |
|
| 447 | - return ""; |
|
| 448 | -} |
|
| 446 | + if($counter) { |
|
| 447 | + return $counter[0]; |
|
| 448 | + } else { |
|
| 449 | + return ""; |
|
| 450 | + } |
|
| 451 | + } |
|
| 449 | 452 | |
| 450 | 453 | //Get user info |
| 451 | 454 | function get_accounts($parent_id,$logger, $db) { |
@@ -115,6 +115,10 @@ |
||
| 115 | 115 | $this->process_invoice($account_value, $start_date, $end_date); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $start_date |
|
| 120 | + * @param string $end_date |
|
| 121 | + */ |
|
| 118 | 122 | function process_invoice($accountdata, $start_date, $end_date) { |
| 119 | 123 | //Get Invoice configuration using single query instead of multiple queries. |
| 120 | 124 | $invoice_conf = array(); |
@@ -43,6 +43,10 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + /** |
|
| 47 | + * @param string $startdate |
|
| 48 | + * @param string $enddate |
|
| 49 | + */ |
|
| 46 | 50 | function process_subscriptions($accountinfo, $startdate, $enddate, $Manualflg = false) { |
| 47 | 51 | // Defined Original Sweep it for calculation start date for first time. |
| 48 | 52 | $accountinfo['original_sweep_id'] = $accountinfo['sweep_id']; |
@@ -101,6 +105,10 @@ discard block |
||
| 101 | 105 | } |
| 102 | 106 | } |
| 103 | 107 | |
| 108 | + /** |
|
| 109 | + * @param string $startdate |
|
| 110 | + * @param string $enddate |
|
| 111 | + */ |
|
| 104 | 112 | function process_DID_charges($AccountDATA, $startdate, $enddate, $Manualflg = false) { |
| 105 | 113 | $dids_data = $this->get_table_data("*", "dids", array("status" => "0", "accountid " => $AccountDATA["id"])); |
| 106 | 114 | $AccountDATA['original_sweep_id'] = $AccountDATA['sweep_id']; |
@@ -225,6 +233,7 @@ discard block |
||
| 225 | 233 | |
| 226 | 234 | /** |
| 227 | 235 | * @param string $todate |
| 236 | + * @param string $invoicedate |
|
| 228 | 237 | */ |
| 229 | 238 | function Manage_invoice_item($AccountData, $description, $item_id, $charge, $type, $fromdate, $todate, $invoicedate) { |
| 230 | 239 | $invoiceid = 0; |
@@ -133,22 +133,25 @@ |
||
| 133 | 133 | if (($parent_id == $reseller_dids['reseller_id'] && $did_value['accountid'] > 0) || $reseller_dids['parent_id'] == 0) { |
| 134 | 134 | //Apply charges to resellers customers. |
| 135 | 135 | $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1"); |
| 136 | - if ($lastdate) |
|
| 137 | - $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
| 136 | + if ($lastdate) { |
|
| 137 | + $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
| 138 | + } |
|
| 138 | 139 | } else { |
| 139 | 140 | //Apply charges to Resellers. |
| 140 | 141 | $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1"); |
| 141 | - if ($lastdate) |
|
| 142 | - $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
| 142 | + if ($lastdate) { |
|
| 143 | + $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
|
| 144 | + } |
|
| 143 | 145 | } |
| 144 | 146 | $parent_id = $reseller_dids['parent_id']; |
| 145 | 147 | } |
| 146 | 148 | } |
| 147 | 149 | // else{ |
| 148 | 150 | $lastdate = $this->calculate_charges($AccountDATA, $itemArr, $did_value["monthlycost"], $fromdate, $todate, "1"); |
| 149 | - if ($lastdate) |
|
| 150 | - $this->db->update("dids", array("charge_upto" => $lastdate), array("id" => $did_value["id"], "accountid" => $AccountDATA["id"])); |
|
| 151 | -// } |
|
| 151 | + if ($lastdate) { |
|
| 152 | + $this->db->update("dids", array("charge_upto" => $lastdate), array("id" => $did_value["id"], "accountid" => $AccountDATA["id"])); |
|
| 153 | + } |
|
| 154 | + // } |
|
| 152 | 155 | } |
| 153 | 156 | } |
| 154 | 157 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param string $orientation page orientation, same as TCPDF |
| 32 | 32 | * @param string $unit User measure unit, same as TCPDF |
| 33 | - * @param mixed $format The format used for pages, same as TCPDF |
|
| 33 | + * @param string $format The format used for pages, same as TCPDF |
|
| 34 | 34 | * @param boolean $unicode TRUE means that the input text is unicode (default = true) |
| 35 | 35 | * @param String $encoding charset encoding; default is UTF-8 |
| 36 | 36 | * @param boolean $diskcache if TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower). |
@@ -1407,7 +1407,6 @@ discard block |
||
| 1407 | 1407 | * set $_myLastPageGroup; |
| 1408 | 1408 | * |
| 1409 | 1409 | * @access public |
| 1410 | - * @param integer $myLastPageGroup; |
|
| 1411 | 1410 | * @param integer $myLastPageGroup |
| 1412 | 1411 | */ |
| 1413 | 1412 | public function setMyLastPageGroup($myLastPageGroup) |
@@ -1430,7 +1429,6 @@ discard block |
||
| 1430 | 1429 | * set $_myLastPageGroupNb; |
| 1431 | 1430 | * |
| 1432 | 1431 | * @access public |
| 1433 | - * @param integer $myLastPageGroupNb; |
|
| 1434 | 1432 | * @param integer $myLastPageGroupNb |
| 1435 | 1433 | */ |
| 1436 | 1434 | public function setMyLastPageGroupNb($myLastPageGroupNb) |
@@ -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']; |
@@ -43,6 +43,7 @@ |
||
| 43 | 43 | * Set the HTML2PDF parent object |
| 44 | 44 | * |
| 45 | 45 | * @param &HTML2PDF reference to the HTML2PDF parent $object |
| 46 | + * @param HTML2PDF_myPdf|null $pdf |
|
| 46 | 47 | * @access public |
| 47 | 48 | */ |
| 48 | 49 | public function setPdfParent(&$pdf) |
@@ -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 | } |
@@ -50,6 +50,7 @@ |
||
| 50 | 50 | * Define the HTML code to parse |
| 51 | 51 | * |
| 52 | 52 | * @param string HTML code |
| 53 | + * @param string $html |
|
| 53 | 54 | * @access public |
| 54 | 55 | */ |
| 55 | 56 | public function setHTML($html) |
@@ -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 |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | * @param array $frame |
| 1124 | 1124 | * @param int $maskNo |
| 1125 | 1125 | * @param int $level |
| 1126 | - * @return array mask |
|
| 1126 | + * @return integer mask |
|
| 1127 | 1127 | */ |
| 1128 | 1128 | protected function makeMask($width, $frame, $maskNo, $level) { |
| 1129 | 1129 | $masked = array_fill(0, $width, str_repeat("\0", $width)); |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | /** |
| 1166 | 1166 | * evaluateSymbol |
| 1167 | 1167 | * @param int $width |
| 1168 | - * @param array $frame |
|
| 1168 | + * @param integer $frame |
|
| 1169 | 1169 | * @return int demerit |
| 1170 | 1170 | */ |
| 1171 | 1171 | protected function evaluateSymbol($width, $frame) { |
@@ -2035,7 +2035,7 @@ discard block |
||
| 2035 | 2035 | |
| 2036 | 2036 | /** |
| 2037 | 2037 | * convertData |
| 2038 | - * @param array $items |
|
| 2038 | + * @param integer $items |
|
| 2039 | 2039 | * @return array items |
| 2040 | 2040 | */ |
| 2041 | 2041 | protected function convertData($items) { |
@@ -2490,7 +2490,7 @@ discard block |
||
| 2490 | 2490 | |
| 2491 | 2491 | /** |
| 2492 | 2492 | * Return BCH encoded format information pattern. |
| 2493 | - * @param array $mask |
|
| 2493 | + * @param integer $mask |
|
| 2494 | 2494 | * @param int $level error correction level |
| 2495 | 2495 | * @return BCH encoded format information pattern |
| 2496 | 2496 | */ |
@@ -64,6 +64,7 @@ |
||
| 64 | 64 | * Custom query result. |
| 65 | 65 | * |
| 66 | 66 | * @param class_name A string that represents the type of object you want back |
| 67 | + * @param string $class_name |
|
| 67 | 68 | * @return array of objects |
| 68 | 69 | */ |
| 69 | 70 | public function custom_result_object($class_name) |
@@ -164,6 +164,7 @@ |
||
| 164 | 164 | * |
| 165 | 165 | * @access private called by execute() |
| 166 | 166 | * @param string an SQL query |
| 167 | + * @param string $sql |
|
| 167 | 168 | * @return string |
| 168 | 169 | */ |
| 169 | 170 | function _prep_query($sql) |
@@ -338,13 +338,15 @@ |
||
| 338 | 338 | */ |
| 339 | 339 | function count_all($table = '') |
| 340 | 340 | { |
| 341 | - if ($table == '') |
|
| 342 | - return '0'; |
|
| 341 | + if ($table == '') { |
|
| 342 | + return '0'; |
|
| 343 | + } |
|
| 343 | 344 | |
| 344 | 345 | $query = $this->query("SELECT COUNT(*) AS numrows FROM ".$this->dbprefix.$table); |
| 345 | 346 | |
| 346 | - if ($query->num_rows() == 0) |
|
| 347 | - return '0'; |
|
| 347 | + if ($query->num_rows() == 0) { |
|
| 348 | + return '0'; |
|
| 349 | + } |
|
| 348 | 350 | |
| 349 | 351 | $row = $query->row(); |
| 350 | 352 | $this->_reset_select(); |