@@ -99,8 +99,9 @@ |
||
| 99 | 99 | $main_data_dir = $argv[4]; // override when executing the script in command line |
| 100 | 100 | } |
| 101 | 101 | // In mode 3 the main_url is custom |
| 102 | - if ($force_install_noedit != 3) |
|
| 103 | - $main_url = detect_dolibarr_main_url_root(); |
|
| 102 | + if ($force_install_noedit != 3) { |
|
| 103 | + $main_url = detect_dolibarr_main_url_root(); |
|
| 104 | + } |
|
| 104 | 105 | if (!empty($argv[5])) { |
| 105 | 106 | $main_url = $argv[5]; // override when executing the script in command line |
| 106 | 107 | } |
@@ -192,7 +192,9 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | if (($action == 'add' || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) { |
| 194 | 194 | $ifErrorAction = $action == 'add' ? 'create' : 'edit'; |
| 195 | - if ($action == 'add') $object->track_id = null; |
|
| 195 | + if ($action == 'add') { |
|
| 196 | + $object->track_id = null; |
|
| 197 | + } |
|
| 196 | 198 | $error = 0; |
| 197 | 199 | |
| 198 | 200 | $fieldsToCheck = [ |
@@ -344,7 +346,9 @@ discard block |
||
| 344 | 346 | $db->rollback(); |
| 345 | 347 | setEventMessages($object->error, $object->errors, 'errors'); |
| 346 | 348 | } |
| 347 | - } else $action = $ifErrorAction; |
|
| 349 | + } else { |
|
| 350 | + $action = $ifErrorAction; |
|
| 351 | + } |
|
| 348 | 352 | } |
| 349 | 353 | |
| 350 | 354 | // Mark as Read |
@@ -49,7 +49,9 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Not sure this is required |
| 52 | -if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 52 | +if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) { |
|
| 53 | + unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 54 | +} |
|
| 53 | 55 | |
| 54 | 56 | if (GETPOST('noredirect')) { |
| 55 | 57 | return; |
@@ -49,35 +49,51 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | |
| 51 | 51 | // include class for decoding filters |
| 52 | -if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH') . '/include/tcpdf_filters.php'); |
|
| 53 | -else require_once(dirname(__FILE__) . '/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
| 52 | +if (defined('TCPDF_PATH')) { |
|
| 53 | + require_once(constant('TCPDF_PATH') . '/include/tcpdf_filters.php'); |
|
| 54 | +} else { |
|
| 55 | + require_once(dirname(__FILE__) . '/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
| 56 | +} |
|
| 54 | 57 | |
| 55 | -if (!defined('PDF_TYPE_NULL')) |
|
| 58 | +if (!defined('PDF_TYPE_NULL')) { |
|
| 56 | 59 | define('PDF_TYPE_NULL', 0); |
| 57 | -if (!defined('PDF_TYPE_NUMERIC')) |
|
| 60 | +} |
|
| 61 | +if (!defined('PDF_TYPE_NUMERIC')) { |
|
| 58 | 62 | define('PDF_TYPE_NUMERIC', 1); |
| 59 | -if (!defined('PDF_TYPE_TOKEN')) |
|
| 63 | +} |
|
| 64 | +if (!defined('PDF_TYPE_TOKEN')) { |
|
| 60 | 65 | define('PDF_TYPE_TOKEN', 2); |
| 61 | -if (!defined('PDF_TYPE_HEX')) |
|
| 66 | +} |
|
| 67 | +if (!defined('PDF_TYPE_HEX')) { |
|
| 62 | 68 | define('PDF_TYPE_HEX', 3); |
| 63 | -if (!defined('PDF_TYPE_STRING')) |
|
| 69 | +} |
|
| 70 | +if (!defined('PDF_TYPE_STRING')) { |
|
| 64 | 71 | define('PDF_TYPE_STRING', 4); |
| 65 | -if (!defined('PDF_TYPE_DICTIONARY')) |
|
| 72 | +} |
|
| 73 | +if (!defined('PDF_TYPE_DICTIONARY')) { |
|
| 66 | 74 | define('PDF_TYPE_DICTIONARY', 5); |
| 67 | -if (!defined('PDF_TYPE_ARRAY')) |
|
| 75 | +} |
|
| 76 | +if (!defined('PDF_TYPE_ARRAY')) { |
|
| 68 | 77 | define('PDF_TYPE_ARRAY', 6); |
| 69 | -if (!defined('PDF_TYPE_OBJDEC')) |
|
| 78 | +} |
|
| 79 | +if (!defined('PDF_TYPE_OBJDEC')) { |
|
| 70 | 80 | define('PDF_TYPE_OBJDEC', 7); |
| 71 | -if (!defined('PDF_TYPE_OBJREF')) |
|
| 81 | +} |
|
| 82 | +if (!defined('PDF_TYPE_OBJREF')) { |
|
| 72 | 83 | define('PDF_TYPE_OBJREF', 8); |
| 73 | -if (!defined('PDF_TYPE_OBJECT')) |
|
| 84 | +} |
|
| 85 | +if (!defined('PDF_TYPE_OBJECT')) { |
|
| 74 | 86 | define('PDF_TYPE_OBJECT', 9); |
| 75 | -if (!defined('PDF_TYPE_STREAM')) |
|
| 87 | +} |
|
| 88 | +if (!defined('PDF_TYPE_STREAM')) { |
|
| 76 | 89 | define('PDF_TYPE_STREAM', 10); |
| 77 | -if (!defined('PDF_TYPE_BOOLEAN')) |
|
| 90 | +} |
|
| 91 | +if (!defined('PDF_TYPE_BOOLEAN')) { |
|
| 78 | 92 | define('PDF_TYPE_BOOLEAN', 11); |
| 79 | -if (!defined('PDF_TYPE_REAL')) |
|
| 93 | +} |
|
| 94 | +if (!defined('PDF_TYPE_REAL')) { |
|
| 80 | 95 | define('PDF_TYPE_REAL', 12); |
| 96 | +} |
|
| 81 | 97 | |
| 82 | 98 | /** |
| 83 | 99 | * @class tcpdi_parser |
@@ -251,8 +267,9 @@ discard block |
||
| 251 | 267 | public function getPDFVersion() |
| 252 | 268 | { |
| 253 | 269 | preg_match('/\d\.\d/', substr($this->pdfdata, 0, 16), $m); |
| 254 | - if (isset($m[0])) |
|
| 255 | - $this->pdfVersion = $m[0]; |
|
| 270 | + if (isset($m[0])) { |
|
| 271 | + $this->pdfVersion = $m[0]; |
|
| 272 | + } |
|
| 256 | 273 | return $this->pdfVersion; |
| 257 | 274 | } |
| 258 | 275 | |
@@ -1211,16 +1228,18 @@ discard block |
||
| 1211 | 1228 | // parent object. |
| 1212 | 1229 | if (isset($obj[1][1]['/Resources'])) { |
| 1213 | 1230 | $res = $obj[1][1]['/Resources']; |
| 1214 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
| 1215 | - return $res[1]; |
|
| 1231 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
| 1232 | + return $res[1]; |
|
| 1233 | + } |
|
| 1216 | 1234 | return $res; |
| 1217 | 1235 | } else { |
| 1218 | 1236 | if (!isset($obj[1][1]['/Parent'])) { |
| 1219 | 1237 | return false; |
| 1220 | 1238 | } else { |
| 1221 | 1239 | $res = $this->_getPageResources($obj[1][1]['/Parent']); |
| 1222 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
| 1223 | - return $res[1]; |
|
| 1240 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
| 1241 | + return $res[1]; |
|
| 1242 | + } |
|
| 1224 | 1243 | return $res; |
| 1225 | 1244 | } |
| 1226 | 1245 | } |
@@ -1324,8 +1343,9 @@ discard block |
||
| 1324 | 1343 | { |
| 1325 | 1344 | $page = $this->getObjectVal($page); |
| 1326 | 1345 | $box = null; |
| 1327 | - if (isset($page[1][1][$box_index])) |
|
| 1328 | - $box =& $page[1][1][$box_index]; |
|
| 1346 | + if (isset($page[1][1][$box_index])) { |
|
| 1347 | + $box =& $page[1][1][$box_index]; |
|
| 1348 | + } |
|
| 1329 | 1349 | |
| 1330 | 1350 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
| 1331 | 1351 | $tmp_box = $this->getObjectVal($box); |
@@ -1398,16 +1418,18 @@ discard block |
||
| 1398 | 1418 | $obj = $this->getObjectVal($obj); |
| 1399 | 1419 | if (isset($obj[1][1]['/Rotate'])) { |
| 1400 | 1420 | $res = $this->getObjectVal($obj[1][1]['/Rotate']); |
| 1401 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
| 1402 | - return $res[1]; |
|
| 1421 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
| 1422 | + return $res[1]; |
|
| 1423 | + } |
|
| 1403 | 1424 | return $res; |
| 1404 | 1425 | } else { |
| 1405 | 1426 | if (!isset($obj[1][1]['/Parent'])) { |
| 1406 | 1427 | return false; |
| 1407 | 1428 | } else { |
| 1408 | 1429 | $res = $this->_getPageRotation($obj[1][1]['/Parent']); |
| 1409 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
| 1410 | - return $res[1]; |
|
| 1430 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
| 1431 | + return $res[1]; |
|
| 1432 | + } |
|
| 1411 | 1433 | return $res; |
| 1412 | 1434 | } |
| 1413 | 1435 | } |
@@ -89,8 +89,9 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $this->current_filename = $filename; |
| 91 | 91 | |
| 92 | - if (!isset($this->parsers[$filename])) |
|
| 93 | - $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
| 92 | + if (!isset($this->parsers[$filename])) { |
|
| 93 | + $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
| 94 | + } |
|
| 94 | 95 | $this->current_parser =& $this->parsers[$filename]; |
| 95 | 96 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
| 96 | 97 | |
@@ -108,8 +109,9 @@ discard block |
||
| 108 | 109 | $filename = uniqid('tcpdi-'); |
| 109 | 110 | $this->current_filename = $filename; |
| 110 | 111 | |
| 111 | - if (!isset($this->parsers[$filename])) |
|
| 112 | - $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
| 112 | + if (!isset($this->parsers[$filename])) { |
|
| 113 | + $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
| 114 | + } |
|
| 113 | 115 | $this->current_parser =& $this->parsers[$filename]; |
| 114 | 116 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
| 115 | 117 | |
@@ -164,14 +166,16 @@ discard block |
||
| 164 | 166 | |
| 165 | 167 | // check if page already imported |
| 166 | 168 | $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
| 167 | - if (isset($this->_importedPages[$pageKey])) |
|
| 168 | - return $this->_importedPages[$pageKey]; |
|
| 169 | + if (isset($this->_importedPages[$pageKey])) { |
|
| 170 | + return $this->_importedPages[$pageKey]; |
|
| 171 | + } |
|
| 169 | 172 | |
| 170 | 173 | $parser =& $this->parsers[$fn]; |
| 171 | 174 | $parser->setPageno($pageno); |
| 172 | 175 | |
| 173 | - if (!in_array($boxName, $parser->availableBoxes)) |
|
| 174 | - return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
| 176 | + if (!in_array($boxName, $parser->availableBoxes)) { |
|
| 177 | + return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
| 178 | + } |
|
| 175 | 179 | |
| 176 | 180 | $pageboxes = $parser->getPageBoxes($pageno, $this->k); |
| 177 | 181 | |
@@ -182,13 +186,16 @@ discard block |
||
| 182 | 186 | * TrimBox: Default -> CropBox |
| 183 | 187 | * ArtBox: Default -> CropBox |
| 184 | 188 | */ |
| 185 | - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) |
|
| 186 | - $boxName = '/CropBox'; |
|
| 187 | - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') |
|
| 188 | - $boxName = '/MediaBox'; |
|
| 189 | + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) { |
|
| 190 | + $boxName = '/CropBox'; |
|
| 191 | + } |
|
| 192 | + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') { |
|
| 193 | + $boxName = '/MediaBox'; |
|
| 194 | + } |
|
| 189 | 195 | |
| 190 | - if (!isset($pageboxes[$boxName])) |
|
| 191 | - return false; |
|
| 196 | + if (!isset($pageboxes[$boxName])) { |
|
| 197 | + return false; |
|
| 198 | + } |
|
| 192 | 199 | |
| 193 | 200 | $this->lastUsedPageBox = $boxName; |
| 194 | 201 | |
@@ -220,8 +227,9 @@ discard block |
||
| 220 | 227 | $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; |
| 221 | 228 | $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; |
| 222 | 229 | |
| 223 | - if ($angle < 0) |
|
| 224 | - $angle += 360; |
|
| 230 | + if ($angle < 0) { |
|
| 231 | + $angle += 360; |
|
| 232 | + } |
|
| 225 | 233 | |
| 226 | 234 | $tpl['_rotationAngle'] = $angle * -1; |
| 227 | 235 | } |
@@ -372,8 +380,9 @@ discard block |
||
| 372 | 380 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 373 | 381 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
| 374 | 382 | $this->_out('/Font <<'); |
| 375 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
| 376 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 383 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
| 384 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 385 | + } |
|
| 377 | 386 | $this->_out('>>'); |
| 378 | 387 | } |
| 379 | 388 | if( |
@@ -383,12 +392,14 @@ discard block |
||
| 383 | 392 | { |
| 384 | 393 | $this->_out('/XObject <<'); |
| 385 | 394 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
| 386 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
| 387 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 395 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
| 396 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 397 | + } |
|
| 388 | 398 | } |
| 389 | 399 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
| 390 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
| 391 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 400 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
| 401 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 402 | + } |
|
| 392 | 403 | } |
| 393 | 404 | $this->_out('>>'); |
| 394 | 405 | } |
@@ -668,8 +679,9 @@ discard block |
||
| 668 | 679 | $out .= chr(0x0A); |
| 669 | 680 | break; |
| 670 | 681 | case "\r": |
| 671 | - if ($count != $n - 1 && $s[$count + 1] == "\n") |
|
| 672 | - $count++; |
|
| 682 | + if ($count != $n - 1 && $s[$count + 1] == "\n") { |
|
| 683 | + $count++; |
|
| 684 | + } |
|
| 673 | 685 | break; |
| 674 | 686 | case "\n": |
| 675 | 687 | break; |
@@ -82,17 +82,22 @@ discard block |
||
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ($this->page <= 0) |
|
| 86 | - $this->error("You have to add a page to fpdf first!"); |
|
| 85 | + if ($this->page <= 0) { |
|
| 86 | + $this->error("You have to add a page to fpdf first!"); |
|
| 87 | + } |
|
| 87 | 88 | |
| 88 | - if ($x == null) |
|
| 89 | - $x = 0; |
|
| 90 | - if ($y == null) |
|
| 91 | - $y = 0; |
|
| 92 | - if ($w == null) |
|
| 93 | - $w = $this->w; |
|
| 94 | - if ($h == null) |
|
| 95 | - $h = $this->h; |
|
| 89 | + if ($x == null) { |
|
| 90 | + $x = 0; |
|
| 91 | + } |
|
| 92 | + if ($y == null) { |
|
| 93 | + $y = 0; |
|
| 94 | + } |
|
| 95 | + if ($w == null) { |
|
| 96 | + $w = $this->w; |
|
| 97 | + } |
|
| 98 | + if ($h == null) { |
|
| 99 | + $h = $this->h; |
|
| 100 | + } |
|
| 96 | 101 | |
| 97 | 102 | // Save settings |
| 98 | 103 | $this->tpl++; |
@@ -169,8 +174,9 @@ discard block |
||
| 169 | 174 | $this->FontSize = $tpl['o_FontSize']; |
| 170 | 175 | |
| 171 | 176 | $fontkey = $this->FontFamily . $this->FontStyle; |
| 172 | - if ($fontkey) |
|
| 173 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
| 177 | + if ($fontkey) { |
|
| 178 | + $this->CurrentFont =& $this->fonts[$fontkey]; |
|
| 179 | + } |
|
| 174 | 180 | |
| 175 | 181 | return $this->tpl; |
| 176 | 182 | } else { |
@@ -197,11 +203,13 @@ discard block |
||
| 197 | 203 | */ |
| 198 | 204 | function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) |
| 199 | 205 | { |
| 200 | - if ($this->page <= 0) |
|
| 201 | - $this->error('You have to add a page first!'); |
|
| 206 | + if ($this->page <= 0) { |
|
| 207 | + $this->error('You have to add a page first!'); |
|
| 208 | + } |
|
| 202 | 209 | |
| 203 | - if (!isset($this->tpls[$tplidx])) |
|
| 204 | - $this->error('Template does not exist!'); |
|
| 210 | + if (!isset($this->tpls[$tplidx])) { |
|
| 211 | + $this->error('Template does not exist!'); |
|
| 212 | + } |
|
| 205 | 213 | |
| 206 | 214 | if ($this->_intpl) { |
| 207 | 215 | $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
@@ -211,10 +219,12 @@ discard block |
||
| 211 | 219 | $w = $tpl['w']; |
| 212 | 220 | $h = $tpl['h']; |
| 213 | 221 | |
| 214 | - if ($_x == null) |
|
| 215 | - $_x = 0; |
|
| 216 | - if ($_y == null) |
|
| 217 | - $_y = 0; |
|
| 222 | + if ($_x == null) { |
|
| 223 | + $_x = 0; |
|
| 224 | + } |
|
| 225 | + if ($_y == null) { |
|
| 226 | + $_y = 0; |
|
| 227 | + } |
|
| 218 | 228 | |
| 219 | 229 | $_x += $tpl['x']; |
| 220 | 230 | $_y += $tpl['y']; |
@@ -255,8 +265,9 @@ discard block |
||
| 255 | 265 | */ |
| 256 | 266 | function getTemplateSize($tplidx, $_w = 0, $_h = 0) |
| 257 | 267 | { |
| 258 | - if (!isset($this->tpls[$tplidx])) |
|
| 259 | - return false; |
|
| 268 | + if (!isset($this->tpls[$tplidx])) { |
|
| 269 | + return false; |
|
| 270 | + } |
|
| 260 | 271 | |
| 261 | 272 | $tpl =& $this->tpls[$tplidx]; |
| 262 | 273 | $w = $tpl['w']; |
@@ -267,10 +278,12 @@ discard block |
||
| 267 | 278 | $_h = $h; |
| 268 | 279 | } |
| 269 | 280 | |
| 270 | - if($_w == 0) |
|
| 271 | - $_w = $_h * $w / $h; |
|
| 272 | - if($_h == 0) |
|
| 273 | - $_h = $_w * $h / $w; |
|
| 281 | + if($_w == 0) { |
|
| 282 | + $_w = $_h * $w / $h; |
|
| 283 | + } |
|
| 284 | + if($_h == 0) { |
|
| 285 | + $_h = $_w * $h / $w; |
|
| 286 | + } |
|
| 274 | 287 | |
| 275 | 288 | return array("w" => $_w, "h" => $_h); |
| 276 | 289 | } |
@@ -347,8 +360,9 @@ discard block |
||
| 347 | 360 | return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); |
| 348 | 361 | } |
| 349 | 362 | |
| 350 | - if ($this->_intpl) |
|
| 351 | - $this->Error('Adding pages in templates isn\'t possible!'); |
|
| 363 | + if ($this->_intpl) { |
|
| 364 | + $this->Error('Adding pages in templates isn\'t possible!'); |
|
| 365 | + } |
|
| 352 | 366 | |
| 353 | 367 | parent::AddPage($orientation, $format); |
| 354 | 368 | } |
@@ -363,8 +377,9 @@ discard block |
||
| 363 | 377 | return call_user_func_array(array($this, 'TCPDF::Link'), $args); |
| 364 | 378 | } |
| 365 | 379 | |
| 366 | - if ($this->_intpl) |
|
| 367 | - $this->Error('Using links in templates aren\'t possible!'); |
|
| 380 | + if ($this->_intpl) { |
|
| 381 | + $this->Error('Using links in templates aren\'t possible!'); |
|
| 382 | + } |
|
| 368 | 383 | |
| 369 | 384 | parent::Link($x, $y, $w, $h, $link); |
| 370 | 385 | } |
@@ -376,8 +391,9 @@ discard block |
||
| 376 | 391 | return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); |
| 377 | 392 | } |
| 378 | 393 | |
| 379 | - if ($this->_intpl) |
|
| 380 | - $this->Error('Adding links in templates aren\'t possible!'); |
|
| 394 | + if ($this->_intpl) { |
|
| 395 | + $this->Error('Adding links in templates aren\'t possible!'); |
|
| 396 | + } |
|
| 381 | 397 | return parent::AddLink(); |
| 382 | 398 | } |
| 383 | 399 | |
@@ -388,8 +404,9 @@ discard block |
||
| 388 | 404 | return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); |
| 389 | 405 | } |
| 390 | 406 | |
| 391 | - if ($this->_intpl) |
|
| 392 | - $this->Error('Setting links in templates aren\'t possible!'); |
|
| 407 | + if ($this->_intpl) { |
|
| 408 | + $this->Error('Setting links in templates aren\'t possible!'); |
|
| 409 | + } |
|
| 393 | 410 | parent::SetLink($link, $y, $page); |
| 394 | 411 | } |
| 395 | 412 | |
@@ -431,8 +448,9 @@ discard block |
||
| 431 | 448 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 432 | 449 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
| 433 | 450 | $this->_out('/Font <<'); |
| 434 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
| 435 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 451 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
| 452 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 453 | + } |
|
| 436 | 454 | $this->_out('>>'); |
| 437 | 455 | } |
| 438 | 456 | if( |
@@ -442,12 +460,14 @@ discard block |
||
| 442 | 460 | { |
| 443 | 461 | $this->_out('/XObject <<'); |
| 444 | 462 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
| 445 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
| 446 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 463 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
| 464 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 465 | + } |
|
| 447 | 466 | } |
| 448 | 467 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
| 449 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
| 450 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 468 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
| 469 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 470 | + } |
|
| 451 | 471 | } |
| 452 | 472 | $this->_out('>>'); |
| 453 | 473 | } |
@@ -198,8 +198,7 @@ discard block |
||
| 198 | 198 | $CurrentBlock = $Block; |
| 199 | 199 | |
| 200 | 200 | continue; |
| 201 | - } |
|
| 202 | - else |
|
| 201 | + } else |
|
| 203 | 202 | { |
| 204 | 203 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
| 205 | 204 | { |
@@ -258,8 +257,7 @@ discard block |
||
| 258 | 257 | if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) |
| 259 | 258 | { |
| 260 | 259 | $CurrentBlock['element']['text'] .= "\n" . $text; |
| 261 | - } |
|
| 262 | - else |
|
| 260 | + } else |
|
| 263 | 261 | { |
| 264 | 262 | $Blocks [] = $CurrentBlock; |
| 265 | 263 | |
@@ -764,8 +762,7 @@ discard block |
||
| 764 | 762 | |
| 765 | 763 | $Block['void'] = true; |
| 766 | 764 | } |
| 767 | - } |
|
| 768 | - else |
|
| 765 | + } else |
|
| 769 | 766 | { |
| 770 | 767 | if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) |
| 771 | 768 | { |
@@ -789,18 +786,21 @@ discard block |
||
| 789 | 786 | return; |
| 790 | 787 | } |
| 791 | 788 | |
| 792 | - if (preg_match('/^<' . $Block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $Line['text'])) // open |
|
| 789 | + if (preg_match('/^<' . $Block['name'] . '(?:[ ]*' . $this->regexHtmlAttribute . ')*[ ]*>/i', $Line['text'])) { |
|
| 790 | + // open |
|
| 793 | 791 | { |
| 794 | 792 | $Block['depth']++; |
| 795 | 793 | } |
| 794 | + } |
|
| 796 | 795 | |
| 797 | - if (preg_match('/(.*?)<\/' . $Block['name'] . '>[ ]*$/i', $Line['text'], $matches)) // close |
|
| 796 | + if (preg_match('/(.*?)<\/' . $Block['name'] . '>[ ]*$/i', $Line['text'], $matches)) { |
|
| 797 | + // close |
|
| 798 | 798 | { |
| 799 | 799 | if ($Block['depth'] > 0) |
| 800 | 800 | { |
| 801 | 801 | $Block['depth']--; |
| 802 | - } |
|
| 803 | - else |
|
| 802 | + } |
|
| 803 | + } else |
|
| 804 | 804 | { |
| 805 | 805 | $Block['closed'] = true; |
| 806 | 806 | } |
@@ -1190,12 +1190,10 @@ discard block |
||
| 1190 | 1190 | if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) |
| 1191 | 1191 | { |
| 1192 | 1192 | $emphasis = 'strong'; |
| 1193 | - } |
|
| 1194 | - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1193 | + } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1195 | 1194 | { |
| 1196 | 1195 | $emphasis = 'em'; |
| 1197 | - } |
|
| 1198 | - else |
|
| 1196 | + } else |
|
| 1199 | 1197 | { |
| 1200 | 1198 | return; |
| 1201 | 1199 | } |
@@ -1279,8 +1277,7 @@ discard block |
||
| 1279 | 1277 | $extent += strlen($matches[0]); |
| 1280 | 1278 | |
| 1281 | 1279 | $remainder = substr($remainder, $extent); |
| 1282 | - } |
|
| 1283 | - else |
|
| 1280 | + } else |
|
| 1284 | 1281 | { |
| 1285 | 1282 | return; |
| 1286 | 1283 | } |
@@ -1295,8 +1292,7 @@ discard block |
||
| 1295 | 1292 | } |
| 1296 | 1293 | |
| 1297 | 1294 | $extent += strlen($matches[0]); |
| 1298 | - } |
|
| 1299 | - else |
|
| 1295 | + } else |
|
| 1300 | 1296 | { |
| 1301 | 1297 | if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) |
| 1302 | 1298 | { |
@@ -1304,8 +1300,7 @@ discard block |
||
| 1304 | 1300 | $definition = strtolower($definition); |
| 1305 | 1301 | |
| 1306 | 1302 | $extent += strlen($matches[0]); |
| 1307 | - } |
|
| 1308 | - else |
|
| 1303 | + } else |
|
| 1309 | 1304 | { |
| 1310 | 1305 | $definition = strtolower($Element['text']); |
| 1311 | 1306 | } |
@@ -1453,8 +1448,7 @@ discard block |
||
| 1453 | 1448 | if ($this->breaksEnabled) |
| 1454 | 1449 | { |
| 1455 | 1450 | $text = preg_replace('/[ ]*\n/', "<br />\n", $text); |
| 1456 | - } |
|
| 1457 | - else |
|
| 1451 | + } else |
|
| 1458 | 1452 | { |
| 1459 | 1453 | $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "<br />\n", $text); |
| 1460 | 1454 | $text = str_replace(" \n", "\n", $text); |
@@ -1516,19 +1510,16 @@ discard block |
||
| 1516 | 1510 | if (isset($Element['handler'])) |
| 1517 | 1511 | { |
| 1518 | 1512 | $markup .= $this->{$Element['handler']}($text, $Element['nonNestables']); |
| 1519 | - } |
|
| 1520 | - elseif (!$permitRawHtml) |
|
| 1513 | + } elseif (!$permitRawHtml) |
|
| 1521 | 1514 | { |
| 1522 | 1515 | $markup .= self::escape($text, true); |
| 1523 | - } |
|
| 1524 | - else |
|
| 1516 | + } else |
|
| 1525 | 1517 | { |
| 1526 | 1518 | $markup .= $text; |
| 1527 | 1519 | } |
| 1528 | 1520 | |
| 1529 | 1521 | $markup .= '</' . $Element['name'] . '>'; |
| 1530 | - } |
|
| 1531 | - else |
|
| 1522 | + } else |
|
| 1532 | 1523 | { |
| 1533 | 1524 | $markup .= ' />'; |
| 1534 | 1525 | } |
@@ -1646,8 +1637,7 @@ discard block |
||
| 1646 | 1637 | if ($len > strlen($string)) |
| 1647 | 1638 | { |
| 1648 | 1639 | return false; |
| 1649 | - } |
|
| 1650 | - else |
|
| 1640 | + } else |
|
| 1651 | 1641 | { |
| 1652 | 1642 | return strtolower(substr($string, 0, $len)) === strtolower($needle); |
| 1653 | 1643 | } |
@@ -134,20 +134,20 @@ discard block |
||
| 134 | 134 | if(isset($this->attributes[$name]) && $strict === false) { |
| 135 | 135 | if ($this->attributize) { |
| 136 | 136 | $this->attributes[$name]->add($value, true); |
| 137 | - }else{ |
|
| 137 | + } else{ |
|
| 138 | 138 | if(isset($this->attributes[$name])) { |
| 139 | 139 | if (is_array($this->attributes[$name]) == false) { |
| 140 | 140 | $this->attributes[$name] = [$this->attributes[$name], $value]; |
| 141 | - }else{ |
|
| 141 | + } else{ |
|
| 142 | 142 | $this->attributes[$name][] = $value; |
| 143 | 143 | } |
| 144 | - }else{ |
|
| 144 | + } else{ |
|
| 145 | 145 | $this->attributes[$name] = $value; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | - }elseif($this->attributize == false){ |
|
| 148 | + } elseif($this->attributize == false){ |
|
| 149 | 149 | $this->attributes[$name] = $value; |
| 150 | - }else{ |
|
| 150 | + } else{ |
|
| 151 | 151 | $this->attributes[$name] = new Attribute($name, $value); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | if ($prev_header !== null) { |
| 264 | 264 | $headers[$prev_header][] = $line; |
| 265 | 265 | } |
| 266 | - }elseif (substr($line, 0, 1) === " ") { |
|
| 266 | + } elseif (substr($line, 0, 1) === " ") { |
|
| 267 | 267 | $line = substr($line, 1); |
| 268 | 268 | $line = trim(rtrim($line)); |
| 269 | 269 | if ($prev_header !== null) { |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | if (is_array($headers[$prev_header])) { |
| 274 | 274 | $headers[$prev_header][] = $line; |
| 275 | - }else{ |
|
| 275 | + } else{ |
|
| 276 | 276 | $headers[$prev_header] .= $line; |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | - }else{ |
|
| 279 | + } else{ |
|
| 280 | 280 | if (($pos = strpos($line, ":")) > 0) { |
| 281 | 281 | $key = trim(rtrim(strtolower(substr($line, 0, $pos)))); |
| 282 | 282 | $key = str_replace("-", "_", $key); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $value = trim(rtrim(substr($line, $pos + 1))); |
| 285 | 285 | if (isset($headers[$key])) { |
| 286 | 286 | $headers[$key][] = $value; |
| 287 | - }else{ |
|
| 287 | + } else{ |
|
| 288 | 288 | $headers[$key] = [$value]; |
| 289 | 289 | } |
| 290 | 290 | $prev_header = $key; |
@@ -293,7 +293,9 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | foreach($headers as $key => $values) { |
| 296 | - if (isset($imap_headers[$key])) continue; |
|
| 296 | + if (isset($imap_headers[$key])) { |
|
| 297 | + continue; |
|
| 298 | + } |
|
| 297 | 299 | $value = null; |
| 298 | 300 | switch($key){ |
| 299 | 301 | case 'from': |
@@ -434,9 +436,9 @@ discard block |
||
| 434 | 436 | return EncodingAliases::get($parameter->value, $this->fallback_encoding); |
| 435 | 437 | } |
| 436 | 438 | } |
| 437 | - }elseif (property_exists($structure, 'charset')) { |
|
| 439 | + } elseif (property_exists($structure, 'charset')) { |
|
| 438 | 440 | return EncodingAliases::get($structure->charset, $this->fallback_encoding); |
| 439 | - }elseif (is_string($structure) === true){ |
|
| 441 | + } elseif (is_string($structure) === true){ |
|
| 440 | 442 | return mb_detect_encoding($structure); |
| 441 | 443 | } |
| 442 | 444 | |
@@ -485,9 +487,9 @@ discard block |
||
| 485 | 487 | } |
| 486 | 488 | } |
| 487 | 489 | } |
| 488 | - }elseif($decoder === 'iconv' && $is_utf8_base) { |
|
| 490 | + } elseif($decoder === 'iconv' && $is_utf8_base) { |
|
| 489 | 491 | $value = iconv_mime_decode($value); |
| 490 | - }elseif($is_utf8_base){ |
|
| 492 | + } elseif($is_utf8_base){ |
|
| 491 | 493 | $value = mb_decode_mimeheader($value); |
| 492 | 494 | } |
| 493 | 495 | |
@@ -522,7 +524,9 @@ discard block |
||
| 522 | 524 | */ |
| 523 | 525 | private function findPriority() |
| 524 | 526 | { |
| 525 | - if(($priority = $this->get("x_priority")) === null) return; |
|
| 527 | + if(($priority = $this->get("x_priority")) === null) { |
|
| 528 | + return; |
|
| 529 | + } |
|
| 526 | 530 | switch((int)"$priority"){ |
| 527 | 531 | case IMAP::MESSAGE_PRIORITY_HIGHEST; |
| 528 | 532 | $priority = IMAP::MESSAGE_PRIORITY_HIGHEST; |
@@ -675,7 +679,7 @@ discard block |
||
| 675 | 679 | foreach ($this->attributes as $key => $value) { |
| 676 | 680 | if (is_array($value)) { |
| 677 | 681 | $value = implode(", ", $value); |
| 678 | - }else{ |
|
| 682 | + } else{ |
|
| 679 | 683 | $value = (string)$value; |
| 680 | 684 | } |
| 681 | 685 | // Only parse strings and don't parse any attributes like the user-agent |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | $content_type = (is_array($content_type)) ? implode(' ', $content_type) : $content_type; |
| 94 | 94 | if(stripos($content_type, 'multipart') === 0) { |
| 95 | 95 | $this->type = IMAP::MESSAGE_TYPE_MULTIPART; |
| 96 | - }else{ |
|
| 96 | + } else{ |
|
| 97 | 97 | $this->type = IMAP::MESSAGE_TYPE_TEXT; |
| 98 | 98 | } |
| 99 | 99 | } |