@@ -1328,14 +1328,14 @@ discard block |
||
| 1328 | 1328 | || preg_match('/'.$keyfilter3.'/', $fullpath) || preg_match('/'.$keyfilter4.'/', $fullpath)); |
| 1329 | 1329 | |
| 1330 | 1330 | if (($test && !$include) || (!$test && $include)) { |
| 1331 | - unset($this->cats[$key]); // @phpstan-ignore-line |
|
| 1331 | + unset($this->cats[$key]); // @phpstan-ignore-line |
|
| 1332 | 1332 | } |
| 1333 | 1333 | } |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | 1336 | dol_syslog(get_class($this)."::get_full_arbo dol_sort_array", LOG_DEBUG); |
| 1337 | 1337 | |
| 1338 | - $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0, 1); // Sort on full label like "Label 1 >> Sublabel a >> Subsublabel" |
|
| 1338 | + $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0, 1); // Sort on full label like "Label 1 >> Sublabel a >> Subsublabel" |
|
| 1339 | 1339 | |
| 1340 | 1340 | return $this->cats; |
| 1341 | 1341 | } |
@@ -1526,15 +1526,15 @@ discard block |
||
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | if ($url == '') { |
| 1529 | - $link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.((int) $cat->id).'&type='.urlencode($cat->type).'" class="'.($i < count($way) ? 'small ': '').$forced_color.'">'; |
|
| 1529 | + $link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.((int) $cat->id).'&type='.urlencode($cat->type).'" class="'.($i < count($way) ? 'small ' : '').$forced_color.'">'; |
|
| 1530 | 1530 | $linkend = '</a>'; |
| 1531 | 1531 | $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; |
| 1532 | 1532 | } elseif ($url == 'none') { |
| 1533 | - $link = '<span class="'.($i < count($way) ? 'small ': '').$forced_color.'">'; |
|
| 1533 | + $link = '<span class="'.($i < count($way) ? 'small ' : '').$forced_color.'">'; |
|
| 1534 | 1534 | $linkend = '</span>'; |
| 1535 | 1535 | $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; |
| 1536 | 1536 | } else { |
| 1537 | - $w[] = '<a class="'.($i < count($way) ? 'small ': '').$forced_color.'" href="'.DOL_URL_ROOT.'/'.$url.'?catid='.((int) $cat->id).'">'.($addpicto ? img_object('', 'category') : '').$cat->label.'</a>'; |
|
| 1537 | + $w[] = '<a class="'.($i < count($way) ? 'small ' : '').$forced_color.'" href="'.DOL_URL_ROOT.'/'.$url.'?catid='.((int) $cat->id).'">'.($addpicto ? img_object('', 'category') : '').$cat->label.'</a>'; |
|
| 1538 | 1538 | } |
| 1539 | 1539 | } |
| 1540 | 1540 | $newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode('<span class="inline-block valignmiddle paddingleft paddingright '.$forced_color.'">'.$sep.'</span>', $w)); |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | $parents = $this->get_meres(); |
| 1594 | 1594 | if (is_array($parents)) { |
| 1595 | 1595 | foreach ($parents as $parent) { |
| 1596 | - $all_ways = $parent->get_all_ways(); // recursivity. TODO Add a protection for infinite loop |
|
| 1596 | + $all_ways = $parent->get_all_ways(); // recursivity. TODO Add a protection for infinite loop |
|
| 1597 | 1597 | foreach ($all_ways as $way) { |
| 1598 | 1598 | $w = $way; |
| 1599 | 1599 | $w[] = $this; |
@@ -1753,10 +1753,10 @@ discard block |
||
| 1753 | 1753 | */ |
| 1754 | 1754 | public function isAnyPhotoAvailable($sdir) |
| 1755 | 1755 | { |
| 1756 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 1757 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; |
|
| 1756 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 1757 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
|
| 1758 | 1758 | |
| 1759 | - $sdir .= '/' . get_exdir($this->id, 2, 0, 0, $this, 'category') . $this->id . "/photos/"; |
|
| 1759 | + $sdir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'category').$this->id."/photos/"; |
|
| 1760 | 1760 | |
| 1761 | 1761 | $dir_osencoded = dol_osencode($sdir); |
| 1762 | 1762 | if (file_exists($dir_osencoded)) { |
@@ -1766,7 +1766,7 @@ discard block |
||
| 1766 | 1766 | if (!utf8_check($file)) { |
| 1767 | 1767 | $file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory |
| 1768 | 1768 | } |
| 1769 | - if (dol_is_file($sdir . $file) && image_format_supported($file) >= 0) { |
|
| 1769 | + if (dol_is_file($sdir.$file) && image_format_supported($file) >= 0) { |
|
| 1770 | 1770 | return true; |
| 1771 | 1771 | } |
| 1772 | 1772 | } |
@@ -1889,7 +1889,7 @@ discard block |
||
| 1889 | 1889 | $result .= $linkend; |
| 1890 | 1890 | |
| 1891 | 1891 | global $action; |
| 1892 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1892 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1893 | 1893 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1894 | 1894 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1895 | 1895 | if ($reshook > 0) { |
@@ -1082,8 +1082,8 @@ discard block |
||
| 1082 | 1082 | $sql .= ", '".$this->db->escape($this->ip)."'"; |
| 1083 | 1083 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 1084 | 1084 | $sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1'); |
| 1085 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 1086 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 1085 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 1086 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | $sql .= ")"; |
| 1089 | 1089 | |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | if ($ret >= 0) { |
| 1139 | - if (! $notrigger) { |
|
| 1139 | + if (!$notrigger) { |
|
| 1140 | 1140 | // Call trigger |
| 1141 | 1141 | $result = $this->call_trigger('COMPANY_CREATE', $user); |
| 1142 | 1142 | if ($result < 0) { |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
| 1385 | 1385 | $langs->loadLangs(array("errors", 'compta')); |
| 1386 | 1386 | $error++; |
| 1387 | - $this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
| 1387 | + $this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
| 1388 | 1388 | } |
| 1389 | 1389 | } |
| 1390 | 1390 | |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) { |
| 1393 | 1393 | $langs->loadLangs(array("errors", 'compta')); |
| 1394 | 1394 | $error++; |
| 1395 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
| 1395 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
| 1396 | 1396 | } |
| 1397 | 1397 | } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) { |
| 1398 | 1398 | // Check for unicity |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { |
| 1401 | 1401 | $langs->loadLangs(array("errors", 'compta')); |
| 1402 | 1402 | $error++; |
| 1403 | - $this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
| 1403 | + $this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
| 1404 | 1404 | } |
| 1405 | 1405 | } |
| 1406 | 1406 | |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) { |
| 1409 | 1409 | $langs->loadLangs(array("errors", 'compta')); |
| 1410 | 1410 | $error++; |
| 1411 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; |
|
| 1411 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')'; |
|
| 1412 | 1412 | } |
| 1413 | 1413 | } |
| 1414 | 1414 | } |
@@ -1458,17 +1458,17 @@ discard block |
||
| 1458 | 1458 | $now = dol_now(); |
| 1459 | 1459 | |
| 1460 | 1460 | // Clean parameters |
| 1461 | - $this->id = $id; |
|
| 1462 | - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); |
|
| 1461 | + $this->id = $id; |
|
| 1462 | + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); |
|
| 1463 | 1463 | $this->name = $this->name ? trim($this->name) : trim((string) $this->nom); |
| 1464 | 1464 | $this->nom = $this->name; // For backward compatibility |
| 1465 | - $this->name_alias = trim((string) $this->name_alias); |
|
| 1465 | + $this->name_alias = trim((string) $this->name_alias); |
|
| 1466 | 1466 | $this->ref_ext = (empty($this->ref_ext) ? '' : trim($this->ref_ext)); |
| 1467 | 1467 | $this->address = trim((string) $this->address); |
| 1468 | 1468 | $this->zip = trim((string) $this->zip); |
| 1469 | 1469 | $this->town = trim((string) $this->town); |
| 1470 | - $this->state_id = (is_numeric($this->state_id)) ? (int) $this->state_id : 0; |
|
| 1471 | - $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; |
|
| 1470 | + $this->state_id = (is_numeric($this->state_id)) ? (int) $this->state_id : 0; |
|
| 1471 | + $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; |
|
| 1472 | 1472 | $this->phone = trim((string) $this->phone); |
| 1473 | 1473 | $this->phone = preg_replace("/\s/", "", $this->phone); |
| 1474 | 1474 | $this->phone = preg_replace("/\./", "", $this->phone); |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | $this->fax = trim((string) $this->fax); |
| 1479 | 1479 | $this->fax = preg_replace("/\s/", "", $this->fax); |
| 1480 | 1480 | $this->fax = preg_replace("/\./", "", $this->fax); |
| 1481 | - $this->email = trim((string) $this->email); |
|
| 1481 | + $this->email = trim((string) $this->email); |
|
| 1482 | 1482 | $this->url = $this->url ? clean_url($this->url, 0) : ''; |
| 1483 | 1483 | $this->note_private = (empty($this->note_private) ? '' : trim($this->note_private)); |
| 1484 | 1484 | $this->note_public = (empty($this->note_public) ? '' : trim($this->note_public)); |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | $sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape((string) $this->tva_assuj)."'" : "null"); |
| 1648 | 1648 | $sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'"; |
| 1649 | 1649 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 1650 | - $sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape((string) $this->vat_reverse_charge) . "'" : 0); |
|
| 1650 | + $sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape((string) $this->vat_reverse_charge)."'" : 0); |
|
| 1651 | 1651 | } |
| 1652 | 1652 | $sql .= ",status = ".((int) $this->status); |
| 1653 | 1653 | |
@@ -1708,8 +1708,8 @@ discard block |
||
| 1708 | 1708 | $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); |
| 1709 | 1709 | $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; |
| 1710 | 1710 | if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 1711 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 1712 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 1711 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 1712 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 1713 | 1713 | if ($customer) { |
| 1714 | 1714 | $sql .= ", accountancy_code_customer_general = ".(!empty($this->accountancy_code_customer_general) ? "'".$this->db->escape($this->accountancy_code_customer_general)."'" : "null"); |
| 1715 | 1715 | $sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null"); |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | $this->vat_reverse_charge = 0; |
| 2108 | 2108 | } |
| 2109 | 2109 | |
| 2110 | - $this->status = $obj->status; |
|
| 2110 | + $this->status = $obj->status; |
|
| 2111 | 2111 | |
| 2112 | 2112 | // Local Taxes |
| 2113 | 2113 | $this->localtax1_assuj = $obj->localtax1_assuj; |
@@ -2134,7 +2134,7 @@ discard block |
||
| 2134 | 2134 | |
| 2135 | 2135 | $this->mode_reglement_id = $obj->mode_reglement; |
| 2136 | 2136 | $this->cond_reglement_id = $obj->cond_reglement; |
| 2137 | - $this->deposit_percent = $obj->deposit_percent; |
|
| 2137 | + $this->deposit_percent = $obj->deposit_percent; |
|
| 2138 | 2138 | $this->transport_mode_id = $obj->transport_mode; |
| 2139 | 2139 | $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; |
| 2140 | 2140 | $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; |
@@ -2700,7 +2700,7 @@ discard block |
||
| 2700 | 2700 | $sortfield = 'u.lastname,u.firstname'; |
| 2701 | 2701 | } |
| 2702 | 2702 | if (empty($sortorder)) { |
| 2703 | - $sortorder = str_repeat('ASC,', count(explode(',', $sortfield)) - 1) . 'ASC'; |
|
| 2703 | + $sortorder = str_repeat('ASC,', count(explode(',', $sortfield)) - 1).'ASC'; |
|
| 2704 | 2704 | } |
| 2705 | 2705 | $sql .= $this->db->order($sortfield, $sortorder); |
| 2706 | 2706 | |
@@ -2717,10 +2717,10 @@ discard block |
||
| 2717 | 2717 | $reparray[$i]['firstname'] = $obj->firstname; |
| 2718 | 2718 | $reparray[$i]['email'] = $obj->email; |
| 2719 | 2719 | $reparray[$i]['phone'] = $obj->office_phone; |
| 2720 | - $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
| 2720 | + $reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone |
|
| 2721 | 2721 | $reparray[$i]['office_fax'] = $obj->office_fax; |
| 2722 | - $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
| 2723 | - $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
| 2722 | + $reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile |
|
| 2723 | + $reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile |
|
| 2724 | 2724 | $reparray[$i]['job'] = $obj->job; |
| 2725 | 2725 | $reparray[$i]['statut'] = $obj->status; // deprecated |
| 2726 | 2726 | $reparray[$i]['status'] = $obj->status; |
@@ -2933,7 +2933,7 @@ discard block |
||
| 2933 | 2933 | $datas['status'] = ' '.$this->getLibStatut(5); |
| 2934 | 2934 | } |
| 2935 | 2935 | if (isset($this->client) && isset($this->fournisseur)) { |
| 2936 | - $datas['type'] = ' ' . $this->getTypeUrl(1, '', 0, 'span'); |
|
| 2936 | + $datas['type'] = ' '.$this->getTypeUrl(1, '', 0, 'span'); |
|
| 2937 | 2937 | } |
| 2938 | 2938 | $datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name)); |
| 2939 | 2939 | if (!empty($this->name_alias) && empty($noaliasinname)) { |
@@ -3001,9 +3001,9 @@ discard block |
||
| 3001 | 3001 | } |
| 3002 | 3002 | // show categories for this record only in ajax to not overload lists |
| 3003 | 3003 | if (!$nofetch && isModEnabled('category') && $this->client) { |
| 3004 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 3004 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 3005 | 3005 | $form = new Form($this->db); |
| 3006 | - $datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
| 3006 | + $datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); |
|
| 3007 | 3007 | } |
| 3008 | 3008 | if (!empty($this->code_fournisseur) && $this->fournisseur) { |
| 3009 | 3009 | $datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur; |
@@ -3014,9 +3014,9 @@ discard block |
||
| 3014 | 3014 | } |
| 3015 | 3015 | // show categories for this record only in ajax to not overload lists |
| 3016 | 3016 | if (!$nofetch && isModEnabled('category') && $this->fournisseur) { |
| 3017 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 3017 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 3018 | 3018 | $form = new Form($this->db); |
| 3019 | - $datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
| 3019 | + $datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); |
|
| 3020 | 3020 | } |
| 3021 | 3021 | |
| 3022 | 3022 | $datas['divclose'] = '</div>'; |
@@ -3564,7 +3564,7 @@ discard block |
||
| 3564 | 3564 | { |
| 3565 | 3565 | // phpcs:enable |
| 3566 | 3566 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
| 3567 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ". (int) $this->id; |
|
| 3567 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND default_rib = 1 AND fk_soc = ".(int) $this->id; |
|
| 3568 | 3568 | $resql = $this->db->query($sql); |
| 3569 | 3569 | if (!$resql) { |
| 3570 | 3570 | $this->error = $this->db->lasterror(); |
@@ -3954,7 +3954,7 @@ discard block |
||
| 3954 | 3954 | global $langs; |
| 3955 | 3955 | |
| 3956 | 3956 | if ($company_id > 0) { |
| 3957 | - $sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id); |
|
| 3957 | + $sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id); |
|
| 3958 | 3958 | $resql = $this->db->query($sql); |
| 3959 | 3959 | if ($resql) { |
| 3960 | 3960 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -4251,7 +4251,7 @@ discard block |
||
| 4251 | 4251 | public function isACompany() |
| 4252 | 4252 | { |
| 4253 | 4253 | // Define if third party is treated as company (or not) when nature is unknown |
| 4254 | - $isACompany = getDolGlobalInt('MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES', 1); // default if not set is 1 because it was like this in all past versions |
|
| 4254 | + $isACompany = getDolGlobalInt('MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES', 1); // default if not set is 1 because it was like this in all past versions |
|
| 4255 | 4255 | |
| 4256 | 4256 | // Now try to guess using different tips |
| 4257 | 4257 | if (!empty($this->tva_intra)) { |
@@ -4585,7 +4585,7 @@ discard block |
||
| 4585 | 4585 | $country_code = $country_label = ''; |
| 4586 | 4586 | if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) { |
| 4587 | 4587 | $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')); |
| 4588 | - $country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0; |
|
| 4588 | + $country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0; |
|
| 4589 | 4589 | if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label" |
| 4590 | 4590 | $country_code = $tmp[1]; |
| 4591 | 4591 | $country_label = $tmp[2]; |
@@ -5462,7 +5462,7 @@ discard block |
||
| 5462 | 5462 | if (method_exists($this, 'getLibStatut')) { |
| 5463 | 5463 | $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>'; |
| 5464 | 5464 | } |
| 5465 | - $return .= '</div>'; // end info-box-content |
|
| 5465 | + $return .= '</div>'; // end info-box-content |
|
| 5466 | 5466 | $return .= '</div>'; |
| 5467 | 5467 | $return .= '</div>'; |
| 5468 | 5468 | |
@@ -5565,7 +5565,7 @@ discard block |
||
| 5565 | 5565 | global $conf, $langs, $hookmanager, $user, $action; |
| 5566 | 5566 | |
| 5567 | 5567 | $error = 0; |
| 5568 | - $soc_origin = new Societe($this->db); // The thirdparty that we will delete |
|
| 5568 | + $soc_origin = new Societe($this->db); // The thirdparty that we will delete |
|
| 5569 | 5569 | |
| 5570 | 5570 | dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id); |
| 5571 | 5571 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | throw new RestException(500, 'Error generating document'); |
| 201 | 201 | } |
| 202 | 202 | } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') { |
| 203 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
| 203 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 204 | 204 | $tmpobject = new FactureFournisseur($this->db); |
| 205 | 205 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
| 206 | 206 | if (!$result) { |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | throw new RestException(500, 'Error generating document'); |
| 238 | 238 | } |
| 239 | 239 | } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
| 240 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 240 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 241 | 241 | |
| 242 | 242 | $tmpobject = new Contrat($this->db); |
| 243 | 243 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | throw new RestException(500, 'Error generating document missing doctemplate parameter'); |
| 254 | 254 | } |
| 255 | 255 | } elseif ($modulepart == 'expedition' || $modulepart == 'shipment') { |
| 256 | - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
| 256 | + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
| 257 | 257 | |
| 258 | 258 | $tmpobject = new Expedition($this->db); |
| 259 | 259 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | throw new RestException(500, 'Error generating document missing doctemplate parameter'); |
| 270 | 270 | } |
| 271 | 271 | } elseif ($modulepart == 'mrp') { |
| 272 | - require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
| 272 | + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
| 273 | 273 | |
| 274 | 274 | $tmpobject = new Mo($this->db); |
| 275 | 275 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | // $recursive = 0; |
| 573 | 573 | } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
| 574 | 574 | $modulepart = 'contrat'; |
| 575 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 575 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 576 | 576 | |
| 577 | 577 | $object = new Contrat($this->db); |
| 578 | 578 | $result = $object->fetch($id, $ref); |
@@ -580,10 +580,10 @@ discard block |
||
| 580 | 580 | throw new RestException(404, 'Contract not found'); |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - $upload_dir = $conf->contrat->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'contract'); |
|
| 583 | + $upload_dir = $conf->contrat->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'contract'); |
|
| 584 | 584 | } elseif ($modulepart == 'projet' || $modulepart == 'project') { |
| 585 | 585 | $modulepart = 'project'; |
| 586 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 586 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 587 | 587 | |
| 588 | 588 | $object = new Project($this->db); |
| 589 | 589 | $result = $object->fetch($id, $ref); |
@@ -591,10 +591,10 @@ discard block |
||
| 591 | 591 | throw new RestException(404, 'Project not found'); |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - $upload_dir = $conf->projet->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'project'); |
|
| 594 | + $upload_dir = $conf->projet->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'project'); |
|
| 595 | 595 | } elseif ($modulepart == 'mrp') { |
| 596 | 596 | $modulepart = 'mrp'; |
| 597 | - require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
| 597 | + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
| 598 | 598 | |
| 599 | 599 | $object = new Mo($this->db); |
| 600 | 600 | $result = $object->fetch($id, $ref); |
@@ -602,13 +602,13 @@ discard block |
||
| 602 | 602 | throw new RestException(404, 'MO not found'); |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - $upload_dir = $conf->mrp->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'mrp'); |
|
| 605 | + $upload_dir = $conf->mrp->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'mrp'); |
|
| 606 | 606 | } else { |
| 607 | 607 | throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | $objectType = $modulepart; |
| 611 | - if (! empty($object->id) && ! empty($object->table_element)) { |
|
| 611 | + if (!empty($object->id) && !empty($object->table_element)) { |
|
| 612 | 612 | $objectType = $object->table_element; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror()); |
| 625 | 625 | } elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) { |
| 626 | 626 | $count = count($filearray); |
| 627 | - for ($i = 0 ; $i < $count ; $i++) { |
|
| 627 | + for ($i = 0; $i < $count; $i++) { |
|
| 628 | 628 | foreach ($ecmfile->lines as $line) { |
| 629 | 629 | if ($filearray[$i]['name'] == $line->filename) { |
| 630 | 630 | // Next line converts EcmFilesLine properties to array |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $object = new Propal($this->db); |
| 778 | 778 | } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { |
| 779 | 779 | $modulepart = 'agenda'; |
| 780 | - require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 780 | + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 781 | 781 | $object = new ActionComm($this->db); |
| 782 | 782 | } elseif ($modulepart == 'contact' || $modulepart == 'socpeople') { |
| 783 | 783 | $modulepart = 'contact'; |
@@ -786,11 +786,11 @@ discard block |
||
| 786 | 786 | $fetchbyid = true; |
| 787 | 787 | } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
| 788 | 788 | $modulepart = 'contrat'; |
| 789 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 789 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 790 | 790 | $object = new Contrat($this->db); |
| 791 | 791 | } elseif ($modulepart == 'mrp') { |
| 792 | 792 | $modulepart = 'mrp'; |
| 793 | - require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
| 793 | + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
| 794 | 794 | $object = new Mo($this->db); |
| 795 | 795 | } else { |
| 796 | 796 | // TODO Implement additional moduleparts |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * View |
| 194 | 194 | */ |
| 195 | 195 | |
| 196 | -$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash |
|
| 196 | +$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int, or a hash |
|
| 197 | 197 | if ($cachestring) { |
| 198 | 198 | // Important: The following code is to avoid a page request by the browser and PHP CPU at each Dolibarr page access. |
| 199 | 199 | // We are here when param cache=xxx to force a cache policy: |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $delaycache = ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600'); |
| 204 | 204 | header('Cache-Control: max-age='.$delaycache.', public, must-revalidate'); |
| 205 | 205 | header('Pragma: cache'); // This is to avoid to have Pragma: no-cache set by proxy or web server |
| 206 | - header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server |
|
| 206 | + header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $delaycache).' GMT'); // This is to avoid to have Expires set by proxy or web server |
|
| 207 | 207 | } else { |
| 208 | 208 | // If any cache on files were disable by config file (for test purpose) |
| 209 | 209 | header('Cache-Control: no-cache'); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Security: Delete string ../ or ..\ into $original_file |
| 267 | -$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..' |
|
| 267 | +$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..' |
|
| 268 | 268 | $original_file = str_replace('../', '/', $original_file); |
| 269 | 269 | $original_file = str_replace('..\\', '/', $original_file); |
| 270 | 270 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | * \brief Page to export documents into a compressed file |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -if (! defined('CSRFCHECK_WITH_TOKEN')) { |
|
| 28 | - define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
|
| 27 | +if (!defined('CSRFCHECK_WITH_TOKEN')) { |
|
| 28 | + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // Load Dolibarr environment |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | |
| 102 | 102 | // Increase limit of time. Works only if we are not in safe mode |
| 103 | -$ExecTimeLimit = getDolGlobalInt('MAIN_ADMIN_TOOLS_EXPORT_FILES_EXEC_TIME_LIMIT', 1800);; // 30mn |
|
| 103 | +$ExecTimeLimit = getDolGlobalInt('MAIN_ADMIN_TOOLS_EXPORT_FILES_EXEC_TIME_LIMIT', 1800); ; // 30mn |
|
| 104 | 104 | if (!empty($ExecTimeLimit)) { |
| 105 | 105 | $err = error_reporting(); |
| 106 | 106 | error_reporting(0); // Disable all errors |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | global $errormsg; |
| 169 | - $ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip); // Can modify $errormsg |
|
| 169 | + $ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip); // Can modify $errormsg |
|
| 170 | 170 | if ($ret < 0) { |
| 171 | 171 | if ($ret == -2) { |
| 172 | 172 | $langs->load("errors"); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } else { |
| 175 | 175 | $langs->load("errors"); |
| 176 | 176 | // @phpstan-ignore-next-line The $errormsg can have been modified by the dol_compress_dir function. |
| 177 | - $errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir).($errormsg ? "\n" . $errormsg : ""); |
|
| 177 | + $errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir).($errormsg ? "\n".$errormsg : ""); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | } elseif (in_array($compression, array('gz', 'bz', 'zstd'))) { |
@@ -51,32 +51,32 @@ discard block |
||
| 51 | 51 | if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php'); |
| 52 | 52 | else require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
| 53 | 53 | |
| 54 | -if (!defined ('PDF_TYPE_NULL')) |
|
| 55 | - define ('PDF_TYPE_NULL', 0); |
|
| 56 | -if (!defined ('PDF_TYPE_NUMERIC')) |
|
| 57 | - define ('PDF_TYPE_NUMERIC', 1); |
|
| 58 | -if (!defined ('PDF_TYPE_TOKEN')) |
|
| 59 | - define ('PDF_TYPE_TOKEN', 2); |
|
| 60 | -if (!defined ('PDF_TYPE_HEX')) |
|
| 61 | - define ('PDF_TYPE_HEX', 3); |
|
| 62 | -if (!defined ('PDF_TYPE_STRING')) |
|
| 63 | - define ('PDF_TYPE_STRING', 4); |
|
| 64 | -if (!defined ('PDF_TYPE_DICTIONARY')) |
|
| 65 | - define ('PDF_TYPE_DICTIONARY', 5); |
|
| 66 | -if (!defined ('PDF_TYPE_ARRAY')) |
|
| 67 | - define ('PDF_TYPE_ARRAY', 6); |
|
| 68 | -if (!defined ('PDF_TYPE_OBJDEC')) |
|
| 69 | - define ('PDF_TYPE_OBJDEC', 7); |
|
| 70 | -if (!defined ('PDF_TYPE_OBJREF')) |
|
| 71 | - define ('PDF_TYPE_OBJREF', 8); |
|
| 72 | -if (!defined ('PDF_TYPE_OBJECT')) |
|
| 73 | - define ('PDF_TYPE_OBJECT', 9); |
|
| 74 | -if (!defined ('PDF_TYPE_STREAM')) |
|
| 75 | - define ('PDF_TYPE_STREAM', 10); |
|
| 76 | -if (!defined ('PDF_TYPE_BOOLEAN')) |
|
| 77 | - define ('PDF_TYPE_BOOLEAN', 11); |
|
| 78 | -if (!defined ('PDF_TYPE_REAL')) |
|
| 79 | - define ('PDF_TYPE_REAL', 12); |
|
| 54 | +if (!defined('PDF_TYPE_NULL')) |
|
| 55 | + define('PDF_TYPE_NULL', 0); |
|
| 56 | +if (!defined('PDF_TYPE_NUMERIC')) |
|
| 57 | + define('PDF_TYPE_NUMERIC', 1); |
|
| 58 | +if (!defined('PDF_TYPE_TOKEN')) |
|
| 59 | + define('PDF_TYPE_TOKEN', 2); |
|
| 60 | +if (!defined('PDF_TYPE_HEX')) |
|
| 61 | + define('PDF_TYPE_HEX', 3); |
|
| 62 | +if (!defined('PDF_TYPE_STRING')) |
|
| 63 | + define('PDF_TYPE_STRING', 4); |
|
| 64 | +if (!defined('PDF_TYPE_DICTIONARY')) |
|
| 65 | + define('PDF_TYPE_DICTIONARY', 5); |
|
| 66 | +if (!defined('PDF_TYPE_ARRAY')) |
|
| 67 | + define('PDF_TYPE_ARRAY', 6); |
|
| 68 | +if (!defined('PDF_TYPE_OBJDEC')) |
|
| 69 | + define('PDF_TYPE_OBJDEC', 7); |
|
| 70 | +if (!defined('PDF_TYPE_OBJREF')) |
|
| 71 | + define('PDF_TYPE_OBJREF', 8); |
|
| 72 | +if (!defined('PDF_TYPE_OBJECT')) |
|
| 73 | + define('PDF_TYPE_OBJECT', 9); |
|
| 74 | +if (!defined('PDF_TYPE_STREAM')) |
|
| 75 | + define('PDF_TYPE_STREAM', 10); |
|
| 76 | +if (!defined('PDF_TYPE_BOOLEAN')) |
|
| 77 | + define('PDF_TYPE_BOOLEAN', 11); |
|
| 78 | +if (!defined('PDF_TYPE_REAL')) |
|
| 79 | + define('PDF_TYPE_REAL', 12); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * @class tcpdi_parser |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @protected |
| 326 | 326 | * @since 1.0.000 (2011-05-24) |
| 327 | 327 | */ |
| 328 | - protected function getXrefData($offset=0, $xref=array()) { |
|
| 328 | + protected function getXrefData($offset = 0, $xref = array()) { |
|
| 329 | 329 | if ($offset == 0) { |
| 330 | 330 | // find last startxref |
| 331 | 331 | if (preg_match('/.*[\r\n]startxref[\s\r\n]+([0-9]+)[\s\r\n]+%%EOF/is', $this->pdfdata, $matches) == 0) { |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * @protected |
| 372 | 372 | * @since 1.0.000 (2011-06-20) |
| 373 | 373 | */ |
| 374 | - protected function decodeXref($startxref, $xref=array()) { |
|
| 374 | + protected function decodeXref($startxref, $xref = array()) { |
|
| 375 | 375 | $this->xref_seen_offsets[] = $startxref; |
| 376 | 376 | if (!isset($xref['xref_location'])) { |
| 377 | 377 | $xref['xref_location'] = $startxref; |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * @protected |
| 456 | 456 | * @since 1.0.003 (2013-03-16) |
| 457 | 457 | */ |
| 458 | - protected function decodeXrefStream($startxref, $xref=array()) { |
|
| 458 | + protected function decodeXrefStream($startxref, $xref = array()) { |
|
| 459 | 459 | // try to read Cross-Reference Stream |
| 460 | 460 | list($xrefobj, $unused) = $this->getRawObject($startxref); |
| 461 | 461 | $xrefcrs = $this->getIndirectObject($xrefobj[1], $startxref, true); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | } |
| 509 | 509 | } |
| 510 | 510 | } elseif ($filltrailer) { |
| 511 | - switch($key) { |
|
| 511 | + switch ($key) { |
|
| 512 | 512 | case '/Size': |
| 513 | 513 | case '/Root': |
| 514 | 514 | case '/Info': |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | // initialize decoded array |
| 533 | 533 | $ddata = array(); |
| 534 | 534 | // initialize first row with zeros |
| 535 | - $prev_row = array_fill (0, $rowlen, 0); |
|
| 535 | + $prev_row = array_fill(0, $rowlen, 0); |
|
| 536 | 536 | // for each row apply PNG unpredictor |
| 537 | 537 | foreach ($sdata as $k => $row) { |
| 538 | 538 | // initialize new row |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | $predictor = (10 + $row[0]); |
| 543 | 543 | } |
| 544 | 544 | // for each byte on the row |
| 545 | - for ($i=1; $i<=$columns; ++$i) { |
|
| 545 | + for ($i = 1; $i <= $columns; ++$i) { |
|
| 546 | 546 | if (!isset($row[$i])) { |
| 547 | 547 | // No more data in this row - we're done here. |
| 548 | 548 | break; |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | $obj[] = PDF_TYPE_STREAM; |
| 694 | 694 | $obj[] = substr($this->pdfdata, $offset, $length); |
| 695 | 695 | |
| 696 | - return array($obj, $offset+$length); |
|
| 696 | + return array($obj, $offset + $length); |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | /** |
@@ -703,9 +703,9 @@ discard block |
||
| 703 | 703 | * @protected |
| 704 | 704 | * @since 1.0.000 (2011-06-20) |
| 705 | 705 | */ |
| 706 | - protected function getRawObject($offset=0, $data=null) { |
|
| 706 | + protected function getRawObject($offset = 0, $data = null) { |
|
| 707 | 707 | if ($data == null) { |
| 708 | - $data =& $this->pdfdata; |
|
| 708 | + $data = & $this->pdfdata; |
|
| 709 | 709 | } |
| 710 | 710 | $objtype = ''; // object type to be returned |
| 711 | 711 | $objval = ''; // object value to be returned |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | break; |
| 817 | 817 | } |
| 818 | 818 | default: { |
| 819 | - $frag = $data[$offset] . @$data[$offset+1] . @$data[$offset+2] . @$data[$offset+3]; |
|
| 819 | + $frag = $data[$offset].@$data[$offset + 1].@$data[$offset + 2].@$data[$offset + 3]; |
|
| 820 | 820 | switch ($frag) { |
| 821 | 821 | case 'endo': |
| 822 | 822 | // indirect object |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | // object start |
| 861 | 861 | $objtype = PDF_TYPE_OBJECT; |
| 862 | 862 | $objval = intval($matches[1]).'_'.intval($matches[2]); |
| 863 | - $offset += strlen ($matches[0]); |
|
| 863 | + $offset += strlen($matches[0]); |
|
| 864 | 864 | } |
| 865 | 865 | } elseif (($numlen = strspn($data, '+-.0123456789', $offset)) > 0) { |
| 866 | 866 | // numeric object |
@@ -889,15 +889,15 @@ discard block |
||
| 889 | 889 | $objval = array(); |
| 890 | 890 | |
| 891 | 891 | // Extract dict from data. |
| 892 | - $i=1; |
|
| 892 | + $i = 1; |
|
| 893 | 893 | $dict = ''; |
| 894 | 894 | $offset += 2; |
| 895 | 895 | do { |
| 896 | - if ($data[$offset] == '>' && $data[$offset+1] == '>') { |
|
| 896 | + if ($data[$offset] == '>' && $data[$offset + 1] == '>') { |
|
| 897 | 897 | $i--; |
| 898 | 898 | $dict .= '>>'; |
| 899 | 899 | $offset += 2; |
| 900 | - } else if ($data[$offset] == '<' && $data[$offset+1] == '<') { |
|
| 900 | + } else if ($data[$offset] == '<' && $data[$offset + 1] == '<') { |
|
| 901 | 901 | $i++; |
| 902 | 902 | $dict .= '<<'; |
| 903 | 903 | $offset += 2; |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | $dict .= $data[$offset]; |
| 906 | 906 | $offset++; |
| 907 | 907 | } |
| 908 | - } while ($i>0); |
|
| 908 | + } while ($i > 0); |
|
| 909 | 909 | |
| 910 | 910 | // Now that we have just the dict, parse it. |
| 911 | 911 | $dictoffset = 0; |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | * @protected |
| 934 | 934 | * @since 1.0.000 (2011-05-24) |
| 935 | 935 | */ |
| 936 | - protected function getIndirectObject($obj_ref, $offset=0, $decoding=true) { |
|
| 936 | + protected function getIndirectObject($obj_ref, $offset = 0, $decoding = true) { |
|
| 937 | 937 | $obj = explode('_', $obj_ref); |
| 938 | 938 | if (($obj === false) OR (count($obj) != 2)) { |
| 939 | 939 | $this->Error('Invalid object reference: '.$obj); |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | do { |
| 954 | 954 | if (($i > 0) AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == PDF_TYPE_DICTIONARY) AND array_key_exists('/Length', $objdata[($i - 1)][1])) { |
| 955 | 955 | // Stream - get using /Length in stream's dict |
| 956 | - $lengthobj = $objdata[($i-1)][1]['/Length']; |
|
| 956 | + $lengthobj = $objdata[($i - 1)][1]['/Length']; |
|
| 957 | 957 | if ($lengthobj[0] === PDF_TYPE_OBJREF) { |
| 958 | 958 | $lengthobj = $this->getObjectVal($lengthobj); |
| 959 | 959 | if ($lengthobj[0] === PDF_TYPE_OBJECT) { |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | $objs = $streaminfo[0]; |
| 1012 | 1012 | if (!isset($this->objstreams[$objs[0]][$objs[1]])) { |
| 1013 | 1013 | // Fetch and decode object stream |
| 1014 | - $offset = $this->findObjectOffset($objs);; |
|
| 1014 | + $offset = $this->findObjectOffset($objs); ; |
|
| 1015 | 1015 | $objstream = $this->getObjectVal(array(PDF_TYPE_OBJREF, $objs[0], $objs[1])); |
| 1016 | 1016 | $decoded = $this->decodeStream($objstream[1][1], $objstream[2][1]); |
| 1017 | 1017 | $this->objstreams[$objs[0]][$objs[1]] = $decoded[0]; // Store just the data, in case we need more from this objstream |
@@ -1045,12 +1045,12 @@ discard block |
||
| 1045 | 1045 | // Not a valid object stream dictionary - skip it. |
| 1046 | 1046 | return; |
| 1047 | 1047 | } |
| 1048 | - $stream = $this->decodeStream($obj[1][1], $obj[2][1]);// Decode object stream, as we need the first bit |
|
| 1048 | + $stream = $this->decodeStream($obj[1][1], $obj[2][1]); // Decode object stream, as we need the first bit |
|
| 1049 | 1049 | $first = intval($obj[1][1]['/First'][1]); |
| 1050 | 1050 | $ints = preg_split('/\s/', substr($stream[0], 0, $first)); // Get list of object / offset pairs |
| 1051 | - for ($j=1; $j<count($ints); $j++) { |
|
| 1051 | + for ($j = 1; $j < count($ints); $j++) { |
|
| 1052 | 1052 | if (($j % 2) == 1) { |
| 1053 | - $this->objstreamobjs[$ints[$j-1]] = array($key, $ints[$j]+$first); |
|
| 1053 | + $this->objstreamobjs[$ints[$j - 1]] = array($key, $ints[$j] + $first); |
|
| 1054 | 1054 | } |
| 1055 | 1055 | } |
| 1056 | 1056 | |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | if (preg_match_all('/(*ANYCRLF)^[\s]*([0-9]+)[\s]+([0-9]+)[\s]+obj/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE) >= 1) { |
| 1069 | 1069 | $i = 0; |
| 1070 | 1070 | $laststreamend = 0; |
| 1071 | - foreach($matches[0] as $match) { |
|
| 1071 | + foreach ($matches[0] as $match) { |
|
| 1072 | 1072 | $offset = $match[1] + strspn($match[0], "\x00\x09\x0a\x0c\x0d\x20"); |
| 1073 | 1073 | if ($offset < $laststreamend) { |
| 1074 | 1074 | // Contained within another stream, skip it. |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | * |
| 1197 | 1197 | * @param array $obj Array of pdf-data |
| 1198 | 1198 | */ |
| 1199 | - private function _getPageResources ($obj) { // $obj = /Page |
|
| 1199 | + private function _getPageResources($obj) { // $obj = /Page |
|
| 1200 | 1200 | $obj = $this->getObjectVal($obj); |
| 1201 | 1201 | |
| 1202 | 1202 | // If the current object has a resources |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | * |
| 1235 | 1235 | * @param array $obj Array of pdf-data |
| 1236 | 1236 | */ |
| 1237 | - private function _getPageAnnotations ($obj) { // $obj = /Page |
|
| 1237 | + private function _getPageAnnotations($obj) { // $obj = /Page |
|
| 1238 | 1238 | $obj = $this->getObjectVal($obj); |
| 1239 | 1239 | |
| 1240 | 1240 | // If the current object has an annotations |
@@ -1269,8 +1269,8 @@ discard block |
||
| 1269 | 1269 | |
| 1270 | 1270 | if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { |
| 1271 | 1271 | $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); |
| 1272 | - foreach($contents AS $tmp_content) { |
|
| 1273 | - $buffer .= $this->_rebuildContentStream($tmp_content) . ' '; |
|
| 1272 | + foreach ($contents AS $tmp_content) { |
|
| 1273 | + $buffer .= $this->_rebuildContentStream($tmp_content).' '; |
|
| 1274 | 1274 | } |
| 1275 | 1275 | } |
| 1276 | 1276 | |
@@ -1296,7 +1296,7 @@ discard block |
||
| 1296 | 1296 | } |
| 1297 | 1297 | } elseif ($content_ref[0] == PDF_TYPE_ARRAY) { |
| 1298 | 1298 | foreach ($content_ref[1] AS $tmp_content_ref) { |
| 1299 | - $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); |
|
| 1299 | + $contents = array_merge($contents, $this->_getPageContent($tmp_content_ref)); |
|
| 1300 | 1300 | } |
| 1301 | 1301 | } |
| 1302 | 1302 | |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | $page = $this->getObjectVal($page); |
| 1352 | 1352 | $box = null; |
| 1353 | 1353 | if (isset($page[1][1][$box_index])) |
| 1354 | - $box =& $page[1][1][$box_index]; |
|
| 1354 | + $box = & $page[1][1][$box_index]; |
|
| 1355 | 1355 | |
| 1356 | 1356 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
| 1357 | 1357 | $tmp_box = $this->getObjectVal($box); |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { |
| 1362 | - $b =& $box[1]; |
|
| 1362 | + $b = & $box[1]; |
|
| 1363 | 1363 | return array('x' => $b[0][1] / $k, |
| 1364 | 1364 | 'y' => $b[1][1] / $k, |
| 1365 | 1365 | 'w' => abs($b[0][1] - $b[2][1]) / $k, |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | private function _getPageBoxes($page, $k) { |
| 1397 | 1397 | $boxes = array(); |
| 1398 | 1398 | |
| 1399 | - foreach($this->availableBoxes AS $box) { |
|
| 1399 | + foreach ($this->availableBoxes AS $box) { |
|
| 1400 | 1400 | if ($_box = $this->getPageBox($page, $box, $k)) { |
| 1401 | 1401 | $boxes[$box] = $_box; |
| 1402 | 1402 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if (!isset($this->parsers[$filename])) |
| 106 | 106 | $this->parsers[$filename] = $this->_getPdfParser($filename); |
| 107 | - $this->current_parser =& $this->parsers[$filename]; |
|
| 107 | + $this->current_parser = & $this->parsers[$filename]; |
|
| 108 | 108 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
| 109 | 109 | |
| 110 | 110 | return $this->parsers[$filename]->getPageCount(); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | if (!isset($this->parsers[$filename])) |
| 124 | 124 | $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
| 125 | - $this->current_parser =& $this->parsers[$filename]; |
|
| 125 | + $this->current_parser = & $this->parsers[$filename]; |
|
| 126 | 126 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
| 127 | 127 | |
| 128 | 128 | return $this->parsers[$filename]->getPageCount(); |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | $fn = $this->current_filename; |
| 172 | 172 | |
| 173 | 173 | // check if page already imported |
| 174 | - $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
|
| 174 | + $pageKey = $fn.'-'.((int) $pageno).$boxName; |
|
| 175 | 175 | if (isset($this->_importedPages[$pageKey])) |
| 176 | 176 | return $this->_importedPages[$pageKey]; |
| 177 | 177 | |
| 178 | - $parser =& $this->parsers[$fn]; |
|
| 178 | + $parser = & $this->parsers[$fn]; |
|
| 179 | 179 | $parser->setPageno($pageno); |
| 180 | 180 | |
| 181 | 181 | if (!in_array($boxName, $parser->availableBoxes)) |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $this->tpl++; |
| 206 | 206 | $this->tpls[$this->tpl] = array(); |
| 207 | - $tpl =& $this->tpls[$this->tpl]; |
|
| 208 | - $tpl['parser'] =& $parser; |
|
| 207 | + $tpl = & $this->tpls[$this->tpl]; |
|
| 208 | + $tpl['parser'] = & $parser; |
|
| 209 | 209 | $tpl['resources'] = $parser->getPageResources(); |
| 210 | 210 | $tpl['buffer'] = $parser->getContent(); |
| 211 | 211 | $tpl['box'] = $box; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | function setPageFormatFromTemplatePage($pageno, $orientation) { |
| 242 | 242 | $fn = $this->current_filename; |
| 243 | - $parser =& $this->parsers[$fn]; |
|
| 243 | + $parser = & $this->parsers[$fn]; |
|
| 244 | 244 | $parser->setPageno($pageno); |
| 245 | 245 | $boxes = $parser->getPageBoxes($pageno, $this->k); |
| 246 | 246 | foreach ($boxes as $name => $box) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /* Wrapper for AddPage() which tracks TOC pages to offset annotations later */ |
| 256 | - function AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false) { |
|
| 256 | + function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) { |
|
| 257 | 257 | if ($this->inxobj) { |
| 258 | 258 | // we are inside an XObject template |
| 259 | 259 | return; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /* Wrapper for AddTOC() which tracks TOC position to offset annotations later */ |
| 268 | - function AddTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { |
|
| 268 | + function AddTOC($page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0, 0, 0)) { |
|
| 269 | 269 | if (!TCPDF_STATIC::empty_string($page)) { |
| 270 | 270 | $this->_TOCpagenum = $page; |
| 271 | 271 | } else { |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | function importAnnotations($pageno) { |
| 279 | 279 | $fn = $this->current_filename; |
| 280 | - $parser =& $this->parsers[$fn]; |
|
| 280 | + $parser = & $this->parsers[$fn]; |
|
| 281 | 281 | $parser->setPageno($pageno); |
| 282 | 282 | $annots = $parser->getPageAnnotations(); |
| 283 | 283 | |
@@ -408,10 +408,10 @@ discard block |
||
| 408 | 408 | */ |
| 409 | 409 | function _putimportedobjects() { |
| 410 | 410 | if (is_array($this->parsers) && count($this->parsers) > 0) { |
| 411 | - foreach($this->parsers AS $filename => $p) { |
|
| 412 | - $this->current_parser =& $this->parsers[$filename]; |
|
| 411 | + foreach ($this->parsers AS $filename => $p) { |
|
| 412 | + $this->current_parser = & $this->parsers[$filename]; |
|
| 413 | 413 | if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { |
| 414 | - while(($n = key($this->_obj_stack[$filename])) !== null) { |
|
| 414 | + while (($n = key($this->_obj_stack[$filename])) !== null) { |
|
| 415 | 415 | $nObj = $this->current_parser->getObjectVal($this->_obj_stack[$filename][$n][1]); |
| 416 | 416 | |
| 417 | 417 | $this->_newobj($this->_obj_stack[$filename][$n][0]); |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | * Private Method that writes the form xobjects |
| 442 | 442 | */ |
| 443 | 443 | function _putformxobjects() { |
| 444 | - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
| 444 | + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
| 445 | 445 | reset($this->tpls); |
| 446 | - foreach($this->tpls AS $tplidx => $tpl) { |
|
| 447 | - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; |
|
| 446 | + foreach ($this->tpls AS $tplidx => $tpl) { |
|
| 447 | + $p = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; |
|
| 448 | 448 | $this->_newobj(); |
| 449 | 449 | $cN = $this->n; // TCPDF/Protection: rem current "n" |
| 450 | 450 | |
| 451 | 451 | $this->tpls[$tplidx]['n'] = $this->n; |
| 452 | - $this->_out('<<' . $filter . '/Type /XObject'); |
|
| 452 | + $this->_out('<<'.$filter.'/Type /XObject'); |
|
| 453 | 453 | $this->_out('/Subtype /Form'); |
| 454 | 454 | $this->_out('/FormType 1'); |
| 455 | 455 | |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | $ty = -$tpl['box']['lly']; |
| 471 | 471 | |
| 472 | 472 | if ($tpl['_rotationAngle'] <> 0) { |
| 473 | - $angle = $tpl['_rotationAngle'] * M_PI/180; |
|
| 474 | - $c=cos($angle); |
|
| 475 | - $s=sin($angle); |
|
| 473 | + $angle = $tpl['_rotationAngle'] * M_PI / 180; |
|
| 474 | + $c = cos($angle); |
|
| 475 | + $s = sin($angle); |
|
| 476 | 476 | |
| 477 | - switch($tpl['_rotationAngle']) { |
|
| 477 | + switch ($tpl['_rotationAngle']) { |
|
| 478 | 478 | case -90: |
| 479 | 479 | $tx = -$tpl['box']['lly']; |
| 480 | 480 | $ty = $tpl['box']['urx']; |
@@ -506,27 +506,27 @@ discard block |
||
| 506 | 506 | $this->_out('/Resources '); |
| 507 | 507 | |
| 508 | 508 | if (isset($tpl['resources'])) { |
| 509 | - $this->current_parser =& $tpl['parser']; |
|
| 509 | + $this->current_parser = & $tpl['parser']; |
|
| 510 | 510 | $this->pdf_write_value($tpl['resources']); // "n" will be changed |
| 511 | 511 | } else { |
| 512 | 512 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 513 | 513 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
| 514 | 514 | $this->_out('/Font <<'); |
| 515 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
| 516 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 515 | + foreach ($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
| 516 | + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
|
| 517 | 517 | $this->_out('>>'); |
| 518 | 518 | } |
| 519 | - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
|
| 519 | + if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
|
| 520 | 520 | isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) |
| 521 | 521 | { |
| 522 | 522 | $this->_out('/XObject <<'); |
| 523 | 523 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
| 524 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
| 525 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 524 | + foreach ($this->_res['tpl'][$tplidx]['images'] as $image) |
|
| 525 | + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
|
| 526 | 526 | } |
| 527 | 527 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
| 528 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
| 529 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 528 | + foreach ($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
| 529 | + $this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R'); |
|
| 530 | 530 | } |
| 531 | 531 | $this->_out('>>'); |
| 532 | 532 | } |
@@ -539,8 +539,8 @@ discard block |
||
| 539 | 539 | $this->n = $cN; // TCPDF: reset to current "n" |
| 540 | 540 | |
| 541 | 541 | $p = $this->_getrawstream($p); |
| 542 | - $this->_out('/Length ' . strlen($p) . ' >>'); |
|
| 543 | - $this->_out("stream\n" . $p . "\nendstream"); |
|
| 542 | + $this->_out('/Length '.strlen($p).' >>'); |
|
| 543 | + $this->_out("stream\n".$p."\nendstream"); |
|
| 544 | 544 | |
| 545 | 545 | $this->_out('endobj'); |
| 546 | 546 | $this->n = $nN; // TCPDF: reset to new "n" |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | //Begin a new object |
| 561 | 561 | if (!$onlynewobj) { |
| 562 | 562 | $this->offsets[$obj_id] = $this->bufferlen; |
| 563 | - $this->_out($obj_id . ' 0 obj'); |
|
| 563 | + $this->_out($obj_id.' 0 obj'); |
|
| 564 | 564 | $this->_current_obj_id = $obj_id; // for later use with encryption |
| 565 | 565 | } |
| 566 | 566 | |
@@ -608,14 +608,14 @@ discard block |
||
| 608 | 608 | switch ($value[0]) { |
| 609 | 609 | |
| 610 | 610 | case PDF_TYPE_TOKEN: |
| 611 | - $this->_straightOut('/'.$value[1] . ' '); |
|
| 611 | + $this->_straightOut('/'.$value[1].' '); |
|
| 612 | 612 | break; |
| 613 | 613 | case PDF_TYPE_NUMERIC: |
| 614 | 614 | case PDF_TYPE_REAL: |
| 615 | 615 | if (is_float($value[1]) && $value[1] != 0) { |
| 616 | - $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' '); |
|
| 616 | + $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.').' '); |
|
| 617 | 617 | } else { |
| 618 | - $this->_straightOut($value[1] . ' '); |
|
| 618 | + $this->_straightOut($value[1].' '); |
|
| 619 | 619 | } |
| 620 | 620 | break; |
| 621 | 621 | |
@@ -637,10 +637,10 @@ discard block |
||
| 637 | 637 | // A dictionary. |
| 638 | 638 | $this->_straightOut('<<'); |
| 639 | 639 | |
| 640 | - reset ($value[1]); |
|
| 640 | + reset($value[1]); |
|
| 641 | 641 | |
| 642 | 642 | foreach ($value[1] as $k => $v) { |
| 643 | - $this->_straightOut($k . ' '); |
|
| 643 | + $this->_straightOut($k.' '); |
|
| 644 | 644 | $this->pdf_write_value($v); |
| 645 | 645 | } |
| 646 | 646 | |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | // An indirect object reference |
| 653 | 653 | // Fill the object stack if needed |
| 654 | - $cpfn =& $this->current_parser->uniqueid; |
|
| 654 | + $cpfn = & $this->current_parser->uniqueid; |
|
| 655 | 655 | |
| 656 | 656 | if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { |
| 657 | 657 | $this->_newobj(false, true); |
@@ -660,13 +660,13 @@ discard block |
||
| 660 | 660 | } |
| 661 | 661 | $objid = $this->_don_obj_stack[$cpfn][$value[1]][0]; |
| 662 | 662 | |
| 663 | - $this->_out($objid . ' 0 R'); |
|
| 663 | + $this->_out($objid.' 0 R'); |
|
| 664 | 664 | break; |
| 665 | 665 | |
| 666 | 666 | case PDF_TYPE_STRING: |
| 667 | 667 | |
| 668 | 668 | // A string. |
| 669 | - $this->_straightOut('(' . $value[1] . ')'); |
|
| 669 | + $this->_straightOut('('.$value[1].')'); |
|
| 670 | 670 | |
| 671 | 671 | break; |
| 672 | 672 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | break; |
| 683 | 683 | |
| 684 | 684 | case PDF_TYPE_HEX: |
| 685 | - $this->_straightOut('<' . $value[1] . '>'); |
|
| 685 | + $this->_straightOut('<'.$value[1].'>'); |
|
| 686 | 686 | break; |
| 687 | 687 | |
| 688 | 688 | case PDF_TYPE_BOOLEAN: |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | * Removes cylced references and closes the file handles of the parser objects |
| 748 | 748 | */ |
| 749 | 749 | function cleanUp() { |
| 750 | - foreach ($this->parsers as $k => $_){ |
|
| 750 | + foreach ($this->parsers as $k => $_) { |
|
| 751 | 751 | $this->parsers[$k]->cleanUp(); |
| 752 | 752 | $this->parsers[$k] = null; |
| 753 | 753 | unset($this->parsers[$k]); |
@@ -755,14 +755,14 @@ discard block |
||
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | // Functions from here on are taken from FPDI's fpdi2tcpdf_bridge.php to remove dependence on it |
| 758 | - function _putstream($s, $n=0) { |
|
| 758 | + function _putstream($s, $n = 0) { |
|
| 759 | 759 | $this->_out($this->_getstream($s, $n)); |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | function _getxobjectdict() { |
| 763 | 763 | $out = parent::_getxobjectdict(); |
| 764 | 764 | if (count($this->tpls)) { |
| 765 | - foreach($this->tpls as $tplidx => $tpl) { |
|
| 765 | + foreach ($this->tpls as $tplidx => $tpl) { |
|
| 766 | 766 | $out .= sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']); |
| 767 | 767 | } |
| 768 | 768 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | function _unescape($s) { |
| 780 | 780 | $out = ''; |
| 781 | 781 | for ($count = 0, $n = strlen($s); $count < $n; $count++) { |
| 782 | - if ($s[$count] != '\\' || $count == $n-1) { |
|
| 782 | + if ($s[$count] != '\\' || $count == $n - 1) { |
|
| 783 | 783 | $out .= $s[$count]; |
| 784 | 784 | } else { |
| 785 | 785 | switch ($s[++$count]) { |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | $out .= chr(0x0A); |
| 805 | 805 | break; |
| 806 | 806 | case "\r": |
| 807 | - if ($count != $n-1 && $s[$count+1] == "\n") |
|
| 807 | + if ($count != $n - 1 && $s[$count + 1] == "\n") |
|
| 808 | 808 | $count++; |
| 809 | 809 | break; |
| 810 | 810 | case "\n": |
@@ -813,14 +813,14 @@ discard block |
||
| 813 | 813 | // Octal-Values |
| 814 | 814 | if (ord($s[$count]) >= ord('0') && |
| 815 | 815 | ord($s[$count]) <= ord('9')) { |
| 816 | - $oct = ''. $s[$count]; |
|
| 816 | + $oct = ''.$s[$count]; |
|
| 817 | 817 | |
| 818 | - if (ord($s[$count+1]) >= ord('0') && |
|
| 819 | - ord($s[$count+1]) <= ord('9')) { |
|
| 818 | + if (ord($s[$count + 1]) >= ord('0') && |
|
| 819 | + ord($s[$count + 1]) <= ord('9')) { |
|
| 820 | 820 | $oct .= $s[++$count]; |
| 821 | 821 | |
| 822 | - if (ord($s[$count+1]) >= ord('0') && |
|
| 823 | - ord($s[$count+1]) <= ord('9')) { |
|
| 822 | + if (ord($s[$count + 1]) >= ord('0') && |
|
| 823 | + ord($s[$count + 1]) <= ord('9')) { |
|
| 824 | 824 | $oct .= $s[++$count]; |
| 825 | 825 | } |
| 826 | 826 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function dolStripPhpCode($str, $replacewith = '') |
| 35 | 35 | { |
| 36 | - $str = str_replace('<?=', '<?php echo', $str); // replace a bad practive |
|
| 36 | + $str = str_replace('<?=', '<?php echo', $str); // replace a bad practive |
|
| 37 | 37 | |
| 38 | 38 | $newstr = ''; |
| 39 | 39 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $str = str_replace('<?=', '<?php echo', $str); |
| 81 | 81 | $str = str_replace('<?php', '__LTINTPHP__', $str); |
| 82 | - $str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this to Off in php.ini |
|
| 82 | + $str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this to Off in php.ini |
|
| 83 | 83 | $str = str_replace('__LTINTPHP__', '<?php', $str); |
| 84 | 84 | |
| 85 | 85 | $newstr = ''; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | global $db, $langs, $conf, $user; |
| 287 | 287 | global $dolibarr_main_url_root, $dolibarr_main_data_root; |
| 288 | 288 | global $website; |
| 289 | - global $includehtmlcontentopened; // $includehtmlcontentopened is the level of includes (start at 0 for main page, 1 for first level include, ...) |
|
| 289 | + global $includehtmlcontentopened; // $includehtmlcontentopened is the level of includes (start at 0 for main page, 1 for first level include, ...) |
|
| 290 | 290 | '@phan-var-force Website $website'; |
| 291 | 291 | |
| 292 | 292 | $nbrep = 0; |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | // at end we replace the '!~!~!~' only if we are in final parent page. |
| 333 | 333 | $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep); |
| 334 | 334 | // Replace occurrence like _service_XXX.php with dolibarr URL |
| 335 | - $content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_service_\2\1', $content, -1, $nbrep); |
|
| 335 | + $content = preg_replace('/([\'"])_service_([^\'"]+)\.php\1/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=_service_\2\1', $content, -1, $nbrep); |
|
| 336 | 336 | // Replace occurrence like _library_XXX.php with dolibarr URL |
| 337 | - $content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_library_\2\1', $content, -1, $nbrep); |
|
| 337 | + $content = preg_replace('/([\'"])_library_([^\'"]+)\.php\1/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=_library_\2\1', $content, -1, $nbrep); |
|
| 338 | 338 | // Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php" |
| 339 | 339 | $content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep); |
| 340 | 340 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | if (getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY')) { |
| 435 | - $content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite ' . getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY'), $content); |
|
| 435 | + $content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.getDolGlobalString('WEBSITE_ADD_CSS_TO_BODY'), $content); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | $content = dolReplaceSmileyCodeWithUTF8($content); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $sql .= " WHERE rowid = ".((int) $websiteid); |
| 470 | 470 | |
| 471 | 471 | $resql = $db->query($sql); |
| 472 | - if (! $resql) { |
|
| 472 | + if (!$resql) { |
|
| 473 | 473 | return -1; |
| 474 | 474 | } |
| 475 | 475 | } |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | unset($tmpwebsitepage); |
| 559 | 559 | } |
| 560 | 560 | if ($result > 0) { |
| 561 | - $currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&cache=3600 |
|
| 561 | + $currenturi = $_SERVER["REQUEST_URI"]; // Example: /public/website/index.php?website=mywebsite.com&pageref=mywebsite-home&cache=3600 |
|
| 562 | 562 | $regtmp = array(); |
| 563 | 563 | if (preg_match('/&pageref=([^&]+)/', $currenturi, $regtmp)) { |
| 564 | 564 | if ($regtmp[0] == $containerref) { |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | if ($newurl) { |
| 582 | 582 | if (!empty($parameters)) { |
| 583 | 583 | $separator = (parse_url($newurl, PHP_URL_QUERY) == null) ? '?' : '&'; |
| 584 | - $newurl = $newurl . $separator . http_build_query($parameters); |
|
| 584 | + $newurl = $newurl.$separator.http_build_query($parameters); |
|
| 585 | 585 | } |
| 586 | 586 | if ($permanent) { |
| 587 | 587 | header("Status: 301 Moved Permanently", false, 301); |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | $hashtags = trim(implode(' #', array_map('trim', explode(',', $websitepage->keywords)))); |
| 947 | 947 | |
| 948 | 948 | // Open Graph |
| 949 | - $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article |
|
| 949 | + $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article |
|
| 950 | 950 | $out .= '<meta name="og:title" content="'.$websitepage->title.'">'."\n"; |
| 951 | 951 | if ($websitepage->image) { |
| 952 | 952 | $out .= '<meta name="og:image" content="'.$website->virtualhost.$image.'">'."\n"; |
@@ -1058,9 +1058,9 @@ discard block |
||
| 1058 | 1058 | $sql = "SELECT COUNT(rowid) as nb"; |
| 1059 | 1059 | $sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; |
| 1060 | 1060 | $sql .= " WHERE entity IN (".getEntity($object->element).")"; |
| 1061 | - $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
| 1061 | + $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
| 1062 | 1062 | $sql .= " AND ".$db->regexpsql('filename', $regexforimg, 1); |
| 1063 | - $sql .= " AND share IS NOT NULL"; // Only image that are public |
|
| 1063 | + $sql .= " AND share IS NOT NULL"; // Only image that are public |
|
| 1064 | 1064 | |
| 1065 | 1065 | $resql = $db->query($sql); |
| 1066 | 1066 | if ($resql) { |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | $sql = "SELECT rowid, ref, share, filename, cover, position"; |
| 1098 | 1098 | $sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; |
| 1099 | 1099 | $sql .= " WHERE entity IN (".getEntity($object->element).")"; |
| 1100 | - $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
| 1100 | + $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); // Filter on object |
|
| 1101 | 1101 | $sql .= " AND ".$db->regexpsql('filename', $regexforimg, 1); |
| 1102 | 1102 | $sql .= ($cover ? "" : " AND cover <> 1"); |
| 1103 | 1103 | if ($cover == 1) { |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | { |
| 1395 | 1395 | $dom = new DOMDocument(); |
| 1396 | 1396 | |
| 1397 | - libxml_use_internal_errors(false); // Avoid to fill memory with xml errors |
|
| 1397 | + libxml_use_internal_errors(false); // Avoid to fill memory with xml errors |
|
| 1398 | 1398 | if (LIBXML_VERSION < 20900) { |
| 1399 | 1399 | // Avoid load of external entities (security problem). |
| 1400 | 1400 | // Required only if LIBXML_VERSION < 20900 |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $errormessage = ''; |
| 179 | 179 | $sql .= " AND EXISTS (SELECT tl.rowid FROM ".MAIN_DB_PREFIX."commande_fournisseurdet AS tl WHERE tl.fk_commande = t.rowid"; |
| 180 | 180 | $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilterlines, $errormessage); |
| 181 | - $sql .= ")"; |
|
| 181 | + $sql .= ")"; |
|
| 182 | 182 | if ($errormessage) { |
| 183 | 183 | throw new RestException(400, 'Error when validating parameter sqlfilterlines -> '.$errormessage); |
| 184 | 184 | } |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | if ($source == 'all' || $source == 'external') { |
| 363 | 363 | $tmpContacts = $this->order->liste_contact(-1, 'external', 0, $type); |
| 364 | - $contacts = array_merge($contacts, $tmpContacts); |
|
| 364 | + $contacts = array_merge($contacts, $tmpContacts); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | if ($source == 'all' || $source == 'internal') { |