@@ -585,19 +585,23 @@ |
||
| 585 | 585 | $duration = $obj->duree; |
| 586 | 586 | $event['location'] = ($obj->socname ? $obj->socname : ""); |
| 587 | 587 | $event['summary'] = $obj->ref." - ". $obj->description; |
| 588 | - if ($obj->ref_client) |
|
| 589 | - $event['summary'].= " (".$obj->ref_client.")"; |
|
| 588 | + if ($obj->ref_client) { |
|
| 589 | + $event['summary'].= " (".$obj->ref_client.")"; |
|
| 590 | + } |
|
| 590 | 591 | |
| 591 | 592 | $event['desc'] = $obj->description; |
| 592 | 593 | |
| 593 | - if ($obj->ref_project) |
|
| 594 | - $event['desc'] .= " - ".$obj->ref_project; |
|
| 594 | + if ($obj->ref_project) { |
|
| 595 | + $event['desc'] .= " - ".$obj->ref_project; |
|
| 596 | + } |
|
| 595 | 597 | |
| 596 | - if ($obj->ref_contract) |
|
| 597 | - $event['desc'] .= " - ".$obj->ref_contract; |
|
| 598 | + if ($obj->ref_contract) { |
|
| 599 | + $event['desc'] .= " - ".$obj->ref_contract; |
|
| 600 | + } |
|
| 598 | 601 | |
| 599 | - if ($obj->note_public) |
|
| 600 | - $event['desc'].= " - ".$obj->note_public; |
|
| 602 | + if ($obj->note_public) { |
|
| 603 | + $event['desc'].= " - ".$obj->note_public; |
|
| 604 | + } |
|
| 601 | 605 | |
| 602 | 606 | $event['startdate'] = $datestart; |
| 603 | 607 | $event['enddate'] = ''; // $dateend; // Not required with type 'journal' |
@@ -213,8 +213,7 @@ discard block |
||
| 213 | 213 | $CurrentBlock = $Block; |
| 214 | 214 | |
| 215 | 215 | continue; |
| 216 | - } |
|
| 217 | - else |
|
| 216 | + } else |
|
| 218 | 217 | { |
| 219 | 218 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
| 220 | 219 | { |
@@ -282,8 +281,7 @@ discard block |
||
| 282 | 281 | if (isset($Block)) |
| 283 | 282 | { |
| 284 | 283 | $CurrentBlock = $Block; |
| 285 | - } |
|
| 286 | - else |
|
| 284 | + } else |
|
| 287 | 285 | { |
| 288 | 286 | if (isset($CurrentBlock)) |
| 289 | 287 | { |
@@ -323,8 +321,7 @@ discard block |
||
| 323 | 321 | if (isset($Component['markup'])) |
| 324 | 322 | { |
| 325 | 323 | $Component['element'] = array('rawHtml' => $Component['markup']); |
| 326 | - } |
|
| 327 | - elseif (isset($Component['hidden'])) |
|
| 324 | + } elseif (isset($Component['hidden'])) |
|
| 328 | 325 | { |
| 329 | 326 | $Component['element'] = array(); |
| 330 | 327 | } |
@@ -584,8 +581,7 @@ discard block |
||
| 584 | 581 | $contentIndent -= 1; |
| 585 | 582 | $matches[1] = substr($matches[1], 0, -$contentIndent); |
| 586 | 583 | $matches[3] = str_repeat(' ', $contentIndent) . $matches[3]; |
| 587 | - } |
|
| 588 | - elseif ($contentIndent === 0) |
|
| 584 | + } elseif ($contentIndent === 0) |
|
| 589 | 585 | { |
| 590 | 586 | $matches[1] .= ' '; |
| 591 | 587 | } |
@@ -687,8 +683,7 @@ discard block |
||
| 687 | 683 | $Block['element']['elements'] []= & $Block['li']; |
| 688 | 684 | |
| 689 | 685 | return $Block; |
| 690 | - } |
|
| 691 | - elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line)) |
|
| 686 | + } elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line)) |
|
| 692 | 687 | { |
| 693 | 688 | return null; |
| 694 | 689 | } |
@@ -1316,12 +1311,10 @@ discard block |
||
| 1316 | 1311 | if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) |
| 1317 | 1312 | { |
| 1318 | 1313 | $emphasis = 'strong'; |
| 1319 | - } |
|
| 1320 | - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1314 | + } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1321 | 1315 | { |
| 1322 | 1316 | $emphasis = 'em'; |
| 1323 | - } |
|
| 1324 | - else |
|
| 1317 | + } else |
|
| 1325 | 1318 | { |
| 1326 | 1319 | return; |
| 1327 | 1320 | } |
@@ -1412,8 +1405,7 @@ discard block |
||
| 1412 | 1405 | $extent += strlen($matches[0]); |
| 1413 | 1406 | |
| 1414 | 1407 | $remainder = substr($remainder, $extent); |
| 1415 | - } |
|
| 1416 | - else |
|
| 1408 | + } else |
|
| 1417 | 1409 | { |
| 1418 | 1410 | return; |
| 1419 | 1411 | } |
@@ -1428,8 +1420,7 @@ discard block |
||
| 1428 | 1420 | } |
| 1429 | 1421 | |
| 1430 | 1422 | $extent += strlen($matches[0]); |
| 1431 | - } |
|
| 1432 | - else |
|
| 1423 | + } else |
|
| 1433 | 1424 | { |
| 1434 | 1425 | if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) |
| 1435 | 1426 | { |
@@ -1437,8 +1428,7 @@ discard block |
||
| 1437 | 1428 | $definition = strtolower($definition); |
| 1438 | 1429 | |
| 1439 | 1430 | $extent += strlen($matches[0]); |
| 1440 | - } |
|
| 1441 | - else |
|
| 1431 | + } else |
|
| 1442 | 1432 | { |
| 1443 | 1433 | $definition = strtolower($Element['handler']['argument']); |
| 1444 | 1434 | } |
@@ -1603,8 +1593,7 @@ discard block |
||
| 1603 | 1593 | $argument = $Element['text']; |
| 1604 | 1594 | unset($Element['text']); |
| 1605 | 1595 | $destination = 'rawHtml'; |
| 1606 | - } |
|
| 1607 | - else |
|
| 1596 | + } else |
|
| 1608 | 1597 | { |
| 1609 | 1598 | $function = $Element['handler']['function']; |
| 1610 | 1599 | $argument = $Element['handler']['argument']; |
@@ -1641,8 +1630,7 @@ discard block |
||
| 1641 | 1630 | if (isset($Element['elements'])) |
| 1642 | 1631 | { |
| 1643 | 1632 | $Element['elements'] = $this->elementsApplyRecursive($closure, $Element['elements']); |
| 1644 | - } |
|
| 1645 | - elseif (isset($Element['element'])) |
|
| 1633 | + } elseif (isset($Element['element'])) |
|
| 1646 | 1634 | { |
| 1647 | 1635 | $Element['element'] = $this->elementApplyRecursive($closure, $Element['element']); |
| 1648 | 1636 | } |
@@ -1655,8 +1643,7 @@ discard block |
||
| 1655 | 1643 | if (isset($Element['elements'])) |
| 1656 | 1644 | { |
| 1657 | 1645 | $Element['elements'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['elements']); |
| 1658 | - } |
|
| 1659 | - elseif (isset($Element['element'])) |
|
| 1646 | + } elseif (isset($Element['element'])) |
|
| 1660 | 1647 | { |
| 1661 | 1648 | $Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']); |
| 1662 | 1649 | } |
@@ -1743,26 +1730,22 @@ discard block |
||
| 1743 | 1730 | if (isset($Element['elements'])) |
| 1744 | 1731 | { |
| 1745 | 1732 | $markup .= $this->elements($Element['elements']); |
| 1746 | - } |
|
| 1747 | - elseif (isset($Element['element'])) |
|
| 1733 | + } elseif (isset($Element['element'])) |
|
| 1748 | 1734 | { |
| 1749 | 1735 | $markup .= $this->element($Element['element']); |
| 1750 | - } |
|
| 1751 | - else |
|
| 1736 | + } else |
|
| 1752 | 1737 | { |
| 1753 | 1738 | if (!$permitRawHtml) |
| 1754 | 1739 | { |
| 1755 | 1740 | $markup .= self::escape($text, true); |
| 1756 | - } |
|
| 1757 | - else |
|
| 1741 | + } else |
|
| 1758 | 1742 | { |
| 1759 | 1743 | $markup .= $text; |
| 1760 | 1744 | } |
| 1761 | 1745 | } |
| 1762 | 1746 | |
| 1763 | 1747 | $markup .= $hasName ? '</' . $Element['name'] . '>' : ''; |
| 1764 | - } |
|
| 1765 | - elseif ($hasName) |
|
| 1748 | + } elseif ($hasName) |
|
| 1766 | 1749 | { |
| 1767 | 1750 | $markup .= ' />'; |
| 1768 | 1751 | } |
@@ -1928,8 +1911,7 @@ discard block |
||
| 1928 | 1911 | if ($len > strlen($string)) |
| 1929 | 1912 | { |
| 1930 | 1913 | return false; |
| 1931 | - } |
|
| 1932 | - else |
|
| 1914 | + } else |
|
| 1933 | 1915 | { |
| 1934 | 1916 | return strtolower(substr($string, 0, $len)) === strtolower($needle); |
| 1935 | 1917 | } |
@@ -88,10 +88,16 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | // To provide debug information on line number processed |
| 90 | 90 | global $count; |
| 91 | - if (empty($count)) $count=1; |
|
| 92 | - else $count++; |
|
| 91 | + if (empty($count)) { |
|
| 92 | + $count=1; |
|
| 93 | + } else { |
|
| 94 | + $count++; |
|
| 95 | + } |
|
| 93 | 96 | |
| 94 | - if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps |
|
| 97 | + if (empty($this->savxml)) { |
|
| 98 | + $this->savxml = $this->xml; |
|
| 99 | + } |
|
| 100 | + // Sav content of line at first line merged, so we will reuse original for next steps |
|
| 95 | 101 | $this->xml = $this->savxml; |
| 96 | 102 | $tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values |
| 97 | 103 | |
@@ -123,7 +129,9 @@ discard block |
||
| 123 | 129 | $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
| 124 | 130 | preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); |
| 125 | 131 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
| 126 | - if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
| 132 | + if (!empty($match[3])) { |
|
| 133 | + $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
| 134 | + } |
|
| 127 | 135 | } |
| 128 | 136 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
| 129 | 137 | $this->xml = preg_replace($reg, '', $this->xml); |
@@ -61,8 +61,9 @@ |
||
| 61 | 61 | $mysoc = $soc; |
| 62 | 62 | |
| 63 | 63 | /* Errors are caught in later tests. */ |
| 64 | - if ($socid <= 0) |
|
| 65 | - return; |
|
| 64 | + if ($socid <= 0) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 66 | 67 | } |
| 67 | 68 | |
| 68 | 69 | /** |
@@ -34,7 +34,10 @@ |
||
| 34 | 34 | throw new PclZipProxyException('PclZip class not loaded - PclZip library |
| 35 | 35 | is required for using PclZipProxy'); ; |
| 36 | 36 | } |
| 37 | - if ($forcedir) $this->tmpdir=preg_replace('|[//\/]$|','',$forcedir); // $this->tmpdir must not contains / at the end |
|
| 37 | + if ($forcedir) { |
|
| 38 | + $this->tmpdir=preg_replace('|[//\/]$|','',$forcedir); |
|
| 39 | + } |
|
| 40 | + // $this->tmpdir must not contains / at the end |
|
| 38 | 41 | } |
| 39 | 42 | |
| 40 | 43 | /** |
@@ -222,7 +222,9 @@ |
||
| 222 | 222 | $listofstatus = array(Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED); |
| 223 | 223 | |
| 224 | 224 | $propalstatic = new Propal($db); |
| 225 | - if ($user->socid > 0) $socid = $user->socid; |
|
| 225 | + if ($user->socid > 0) { |
|
| 226 | + $socid = $user->socid; |
|
| 227 | + } |
|
| 226 | 228 | $sql = "SELECT count(p.rowid) as nb, p.fk_statut as status"; |
| 227 | 229 | $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
| 228 | 230 | $sql .= ", ".MAIN_DB_PREFIX."propal as p"; |
@@ -240,7 +240,9 @@ |
||
| 240 | 240 | /* |
| 241 | 241 | * Statistics |
| 242 | 242 | */ |
| 243 | - if ($user->socid > 0) $socid = $user->socid; |
|
| 243 | + if ($user->socid > 0) { |
|
| 244 | + $socid = $user->socid; |
|
| 245 | + } |
|
| 244 | 246 | $sql = "SELECT count(c.rowid) as nb, c.fk_statut as status"; |
| 245 | 247 | $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
| 246 | 248 | $sql .= ", ".MAIN_DB_PREFIX."commande as c"; |
@@ -48,35 +48,51 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | |
| 50 | 50 | // include class for decoding filters |
| 51 | -if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php'); |
|
| 52 | -else require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
| 51 | +if (defined('TCPDF_PATH')) { |
|
| 52 | + require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php'); |
|
| 53 | +} else { |
|
| 54 | + require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
| 55 | +} |
|
| 53 | 56 | |
| 54 | -if (!defined ('PDF_TYPE_NULL')) |
|
| 57 | +if (!defined ('PDF_TYPE_NULL')) { |
|
| 55 | 58 | define ('PDF_TYPE_NULL', 0); |
| 56 | -if (!defined ('PDF_TYPE_NUMERIC')) |
|
| 59 | +} |
|
| 60 | +if (!defined ('PDF_TYPE_NUMERIC')) { |
|
| 57 | 61 | define ('PDF_TYPE_NUMERIC', 1); |
| 58 | -if (!defined ('PDF_TYPE_TOKEN')) |
|
| 62 | +} |
|
| 63 | +if (!defined ('PDF_TYPE_TOKEN')) { |
|
| 59 | 64 | define ('PDF_TYPE_TOKEN', 2); |
| 60 | -if (!defined ('PDF_TYPE_HEX')) |
|
| 65 | +} |
|
| 66 | +if (!defined ('PDF_TYPE_HEX')) { |
|
| 61 | 67 | define ('PDF_TYPE_HEX', 3); |
| 62 | -if (!defined ('PDF_TYPE_STRING')) |
|
| 68 | +} |
|
| 69 | +if (!defined ('PDF_TYPE_STRING')) { |
|
| 63 | 70 | define ('PDF_TYPE_STRING', 4); |
| 64 | -if (!defined ('PDF_TYPE_DICTIONARY')) |
|
| 71 | +} |
|
| 72 | +if (!defined ('PDF_TYPE_DICTIONARY')) { |
|
| 65 | 73 | define ('PDF_TYPE_DICTIONARY', 5); |
| 66 | -if (!defined ('PDF_TYPE_ARRAY')) |
|
| 74 | +} |
|
| 75 | +if (!defined ('PDF_TYPE_ARRAY')) { |
|
| 67 | 76 | define ('PDF_TYPE_ARRAY', 6); |
| 68 | -if (!defined ('PDF_TYPE_OBJDEC')) |
|
| 77 | +} |
|
| 78 | +if (!defined ('PDF_TYPE_OBJDEC')) { |
|
| 69 | 79 | define ('PDF_TYPE_OBJDEC', 7); |
| 70 | -if (!defined ('PDF_TYPE_OBJREF')) |
|
| 80 | +} |
|
| 81 | +if (!defined ('PDF_TYPE_OBJREF')) { |
|
| 71 | 82 | define ('PDF_TYPE_OBJREF', 8); |
| 72 | -if (!defined ('PDF_TYPE_OBJECT')) |
|
| 83 | +} |
|
| 84 | +if (!defined ('PDF_TYPE_OBJECT')) { |
|
| 73 | 85 | define ('PDF_TYPE_OBJECT', 9); |
| 74 | -if (!defined ('PDF_TYPE_STREAM')) |
|
| 86 | +} |
|
| 87 | +if (!defined ('PDF_TYPE_STREAM')) { |
|
| 75 | 88 | define ('PDF_TYPE_STREAM', 10); |
| 76 | -if (!defined ('PDF_TYPE_BOOLEAN')) |
|
| 89 | +} |
|
| 90 | +if (!defined ('PDF_TYPE_BOOLEAN')) { |
|
| 77 | 91 | define ('PDF_TYPE_BOOLEAN', 11); |
| 78 | -if (!defined ('PDF_TYPE_REAL')) |
|
| 92 | +} |
|
| 93 | +if (!defined ('PDF_TYPE_REAL')) { |
|
| 79 | 94 | define ('PDF_TYPE_REAL', 12); |
| 95 | +} |
|
| 80 | 96 | |
| 81 | 97 | /** |
| 82 | 98 | * @class tcpdi_parser |
@@ -245,8 +261,9 @@ discard block |
||
| 245 | 261 | */ |
| 246 | 262 | public function getPDFVersion() { |
| 247 | 263 | preg_match('/\d\.\d/', substr($this->pdfdata, 0, 16), $m); |
| 248 | - if (isset($m[0])) |
|
| 249 | - $this->pdfVersion = $m[0]; |
|
| 264 | + if (isset($m[0])) { |
|
| 265 | + $this->pdfVersion = $m[0]; |
|
| 266 | + } |
|
| 250 | 267 | return $this->pdfVersion; |
| 251 | 268 | } |
| 252 | 269 | |
@@ -1205,16 +1222,18 @@ discard block |
||
| 1205 | 1222 | // parent object. |
| 1206 | 1223 | if (isset ($obj[1][1]['/Resources'])) { |
| 1207 | 1224 | $res = $obj[1][1]['/Resources']; |
| 1208 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
| 1209 | - return $res[1]; |
|
| 1225 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
| 1226 | + return $res[1]; |
|
| 1227 | + } |
|
| 1210 | 1228 | return $res; |
| 1211 | 1229 | } else { |
| 1212 | 1230 | if (!isset ($obj[1][1]['/Parent'])) { |
| 1213 | 1231 | return false; |
| 1214 | 1232 | } else { |
| 1215 | 1233 | $res = $this->_getPageResources($obj[1][1]['/Parent']); |
| 1216 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
| 1217 | - return $res[1]; |
|
| 1234 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
| 1235 | + return $res[1]; |
|
| 1236 | + } |
|
| 1218 | 1237 | return $res; |
| 1219 | 1238 | } |
| 1220 | 1239 | } |
@@ -1251,8 +1270,9 @@ discard block |
||
| 1251 | 1270 | } |
| 1252 | 1271 | } |
| 1253 | 1272 | |
| 1254 | - if ($annots[0] == PDF_TYPE_OBJREF) |
|
| 1255 | - return $this->getObjectVal($annots); |
|
| 1273 | + if ($annots[0] == PDF_TYPE_OBJREF) { |
|
| 1274 | + return $this->getObjectVal($annots); |
|
| 1275 | + } |
|
| 1256 | 1276 | return $annots; |
| 1257 | 1277 | } |
| 1258 | 1278 | |
@@ -1350,8 +1370,9 @@ discard block |
||
| 1350 | 1370 | public function getPageBox($page, $box_index, $k) { |
| 1351 | 1371 | $page = $this->getObjectVal($page); |
| 1352 | 1372 | $box = null; |
| 1353 | - if (isset($page[1][1][$box_index])) |
|
| 1354 | - $box =& $page[1][1][$box_index]; |
|
| 1373 | + if (isset($page[1][1][$box_index])) { |
|
| 1374 | + $box =& $page[1][1][$box_index]; |
|
| 1375 | + } |
|
| 1355 | 1376 | |
| 1356 | 1377 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
| 1357 | 1378 | $tmp_box = $this->getObjectVal($box); |
@@ -1419,16 +1440,18 @@ discard block |
||
| 1419 | 1440 | $obj = $this->getObjectVal($obj); |
| 1420 | 1441 | if (isset ($obj[1][1]['/Rotate'])) { |
| 1421 | 1442 | $res = $this->getObjectVal($obj[1][1]['/Rotate']); |
| 1422 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
| 1423 | - return $res[1]; |
|
| 1443 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
| 1444 | + return $res[1]; |
|
| 1445 | + } |
|
| 1424 | 1446 | return $res; |
| 1425 | 1447 | } else { |
| 1426 | 1448 | if (!isset ($obj[1][1]['/Parent'])) { |
| 1427 | 1449 | return false; |
| 1428 | 1450 | } else { |
| 1429 | 1451 | $res = $this->_getPageRotation($obj[1][1]['/Parent']); |
| 1430 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
| 1431 | - return $res[1]; |
|
| 1452 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
| 1453 | + return $res[1]; |
|
| 1454 | + } |
|
| 1432 | 1455 | return $res; |
| 1433 | 1456 | } |
| 1434 | 1457 | } |
@@ -102,8 +102,9 @@ discard block |
||
| 102 | 102 | function setSourceFile($filename) { |
| 103 | 103 | $this->current_filename = $filename; |
| 104 | 104 | |
| 105 | - if (!isset($this->parsers[$filename])) |
|
| 106 | - $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
| 105 | + if (!isset($this->parsers[$filename])) { |
|
| 106 | + $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
| 107 | + } |
|
| 107 | 108 | $this->current_parser =& $this->parsers[$filename]; |
| 108 | 109 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
| 109 | 110 | |
@@ -120,8 +121,9 @@ discard block |
||
| 120 | 121 | $filename = uniqid('tcpdi-'); |
| 121 | 122 | $this->current_filename = $filename; |
| 122 | 123 | |
| 123 | - if (!isset($this->parsers[$filename])) |
|
| 124 | - $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
| 124 | + if (!isset($this->parsers[$filename])) { |
|
| 125 | + $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
| 126 | + } |
|
| 125 | 127 | $this->current_parser =& $this->parsers[$filename]; |
| 126 | 128 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
| 127 | 129 | |
@@ -172,14 +174,16 @@ discard block |
||
| 172 | 174 | |
| 173 | 175 | // check if page already imported |
| 174 | 176 | $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
| 175 | - if (isset($this->_importedPages[$pageKey])) |
|
| 176 | - return $this->_importedPages[$pageKey]; |
|
| 177 | + if (isset($this->_importedPages[$pageKey])) { |
|
| 178 | + return $this->_importedPages[$pageKey]; |
|
| 179 | + } |
|
| 177 | 180 | |
| 178 | 181 | $parser =& $this->parsers[$fn]; |
| 179 | 182 | $parser->setPageno($pageno); |
| 180 | 183 | |
| 181 | - if (!in_array($boxName, $parser->availableBoxes)) |
|
| 182 | - return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
| 184 | + if (!in_array($boxName, $parser->availableBoxes)) { |
|
| 185 | + return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
| 186 | + } |
|
| 183 | 187 | |
| 184 | 188 | $pageboxes = $parser->getPageBoxes($pageno, $this->k); |
| 185 | 189 | |
@@ -190,13 +194,16 @@ discard block |
||
| 190 | 194 | * TrimBox: Default -> CropBox |
| 191 | 195 | * ArtBox: Default -> CropBox |
| 192 | 196 | */ |
| 193 | - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) |
|
| 194 | - $boxName = '/CropBox'; |
|
| 195 | - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') |
|
| 196 | - $boxName = '/MediaBox'; |
|
| 197 | + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) { |
|
| 198 | + $boxName = '/CropBox'; |
|
| 199 | + } |
|
| 200 | + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') { |
|
| 201 | + $boxName = '/MediaBox'; |
|
| 202 | + } |
|
| 197 | 203 | |
| 198 | - if (!isset($pageboxes[$boxName])) |
|
| 199 | - return false; |
|
| 204 | + if (!isset($pageboxes[$boxName])) { |
|
| 205 | + return false; |
|
| 206 | + } |
|
| 200 | 207 | |
| 201 | 208 | $this->lastUsedPageBox = $boxName; |
| 202 | 209 | |
@@ -228,8 +235,9 @@ discard block |
||
| 228 | 235 | $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; |
| 229 | 236 | $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; |
| 230 | 237 | |
| 231 | - if ($angle < 0) |
|
| 232 | - $angle += 360; |
|
| 238 | + if ($angle < 0) { |
|
| 239 | + $angle += 360; |
|
| 240 | + } |
|
| 233 | 241 | |
| 234 | 242 | $tpl['_rotationAngle'] = $angle * -1; |
| 235 | 243 | } |
@@ -282,10 +290,12 @@ discard block |
||
| 282 | 290 | $annots = $parser->getPageAnnotations(); |
| 283 | 291 | |
| 284 | 292 | if (is_array($annots) && $annots[0] == PDF_TYPE_ARRAY // It's an array |
| 285 | - && is_array($annots[1]) && count($annots[1]) > 1) // It's not empty - there are annotations for this page |
|
| 293 | + && is_array($annots[1]) && count($annots[1]) > 1) { |
|
| 294 | + // It's not empty - there are annotations for this page |
|
| 286 | 295 | { |
| 287 | 296 | if (!isset($this->_obj_stack[$fn])) { |
| 288 | 297 | $this->_obj_stack[$fn] = array(); |
| 298 | + } |
|
| 289 | 299 | } |
| 290 | 300 | |
| 291 | 301 | $this->_importedAnnots[$this->page] = array(); |
@@ -296,10 +306,12 @@ discard block |
||
| 296 | 306 | |
| 297 | 307 | if (is_array($annots) && $annots[0] == PDF_TYPE_OBJECT // We got an object |
| 298 | 308 | && is_array($annots[1]) && $annots[1][0] == PDF_TYPE_ARRAY // It's an array |
| 299 | - && is_array($annots[1][1]) && count($annots[1][1]) > 1) // It's not empty - there are annotations for this page |
|
| 309 | + && is_array($annots[1][1]) && count($annots[1][1]) > 1) { |
|
| 310 | + // It's not empty - there are annotations for this page |
|
| 300 | 311 | { |
| 301 | 312 | if (!isset($this->_obj_stack[$fn])) { |
| 302 | 313 | $this->_obj_stack[$fn] = array(); |
| 314 | + } |
|
| 303 | 315 | } |
| 304 | 316 | |
| 305 | 317 | $this->_importedAnnots[$this->page] = array(); |
@@ -512,8 +524,9 @@ discard block |
||
| 512 | 524 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 513 | 525 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
| 514 | 526 | $this->_out('/Font <<'); |
| 515 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
| 516 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 527 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
| 528 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 529 | + } |
|
| 517 | 530 | $this->_out('>>'); |
| 518 | 531 | } |
| 519 | 532 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -521,12 +534,14 @@ discard block |
||
| 521 | 534 | { |
| 522 | 535 | $this->_out('/XObject <<'); |
| 523 | 536 | 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'); |
|
| 537 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
| 538 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 539 | + } |
|
| 526 | 540 | } |
| 527 | 541 | 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'); |
|
| 542 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
| 543 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 544 | + } |
|
| 530 | 545 | } |
| 531 | 546 | $this->_out('>>'); |
| 532 | 547 | } |
@@ -804,8 +819,9 @@ discard block |
||
| 804 | 819 | $out .= chr(0x0A); |
| 805 | 820 | break; |
| 806 | 821 | case "\r": |
| 807 | - if ($count != $n-1 && $s[$count+1] == "\n") |
|
| 808 | - $count++; |
|
| 822 | + if ($count != $n-1 && $s[$count+1] == "\n") { |
|
| 823 | + $count++; |
|
| 824 | + } |
|
| 809 | 825 | break; |
| 810 | 826 | case "\n": |
| 811 | 827 | break; |