@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | public static function retrieve($_id, $_opts = null) |
89 | 89 | { |
90 | 90 | $msg = 'Bank accounts cannot be retrieved without a customer ID or ' . |
91 | - 'an account ID. Retrieve a bank account using ' . |
|
92 | - "`Customer::retrieveSource('customer_id', " . |
|
93 | - "'bank_account_id')` or `Account::retrieveExternalAccount(" . |
|
94 | - "'account_id', 'bank_account_id')`."; |
|
91 | + 'an account ID. Retrieve a bank account using ' . |
|
92 | + "`Customer::retrieveSource('customer_id', " . |
|
93 | + "'bank_account_id')` or `Account::retrieveExternalAccount(" . |
|
94 | + "'account_id', 'bank_account_id')`."; |
|
95 | 95 | |
96 | 96 | throw new Exception\BadMethodCallException($msg); |
97 | 97 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | public static function update($_id, $_params = null, $_options = null) |
107 | 107 | { |
108 | 108 | $msg = 'Bank accounts cannot be updated without a customer ID or an ' . |
109 | - 'account ID. Update a bank account using ' . |
|
110 | - "`Customer::updateSource('customer_id', 'bank_account_id', " . |
|
111 | - '$updateParams)` or `Account::updateExternalAccount(' . |
|
112 | - "'account_id', 'bank_account_id', \$updateParams)`."; |
|
109 | + 'account ID. Update a bank account using ' . |
|
110 | + "`Customer::updateSource('customer_id', 'bank_account_id', " . |
|
111 | + '$updateParams)` or `Account::updateExternalAccount(' . |
|
112 | + "'account_id', 'bank_account_id', \$updateParams)`."; |
|
113 | 113 | |
114 | 114 | throw new Exception\BadMethodCallException($msg); |
115 | 115 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | public static function retrieve($_id, $_opts = null) |
79 | 79 | { |
80 | 80 | $msg = 'Customer Balance Transactions cannot be retrieved without a ' . |
81 | - 'customer ID. Retrieve a Customer Balance Transaction using ' . |
|
82 | - "`Customer::retrieveBalanceTransaction('customer_id', " . |
|
83 | - "'balance_transaction_id')`."; |
|
81 | + 'customer ID. Retrieve a Customer Balance Transaction using ' . |
|
82 | + "`Customer::retrieveBalanceTransaction('customer_id', " . |
|
83 | + "'balance_transaction_id')`."; |
|
84 | 84 | |
85 | 85 | throw new Exception\BadMethodCallException($msg); |
86 | 86 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | public static function update($_id, $_params = null, $_options = null) |
96 | 96 | { |
97 | 97 | $msg = 'Customer Balance Transactions cannot be updated without a ' . |
98 | - 'customer ID. Update a Customer Balance Transaction using ' . |
|
99 | - "`Customer::updateBalanceTransaction('customer_id', " . |
|
100 | - "'balance_transaction_id', \$updateParams)`."; |
|
98 | + 'customer ID. Update a Customer Balance Transaction using ' . |
|
99 | + "`Customer::updateBalanceTransaction('customer_id', " . |
|
100 | + "'balance_transaction_id', \$updateParams)`."; |
|
101 | 101 | |
102 | 102 | throw new Exception\BadMethodCallException($msg); |
103 | 103 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | public static function retrieve($_id, $_opts = null) |
65 | 65 | { |
66 | 66 | $msg = 'Capabilities cannot be retrieved without an account ID. ' . |
67 | - 'Retrieve a capability using `Account::retrieveCapability(' . |
|
68 | - "'account_id', 'capability_id')`."; |
|
67 | + 'Retrieve a capability using `Account::retrieveCapability(' . |
|
68 | + "'account_id', 'capability_id')`."; |
|
69 | 69 | |
70 | 70 | throw new Exception\BadMethodCallException($msg); |
71 | 71 | } |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | public static function update($_id, $_params = null, $_options = null) |
81 | 81 | { |
82 | 82 | $msg = 'Capabilities cannot be updated without an account ID. ' . |
83 | - 'Update a capability using `Account::updateCapability(' . |
|
84 | - "'account_id', 'capability_id', \$updateParams)`."; |
|
83 | + 'Update a capability using `Account::updateCapability(' . |
|
84 | + "'account_id', 'capability_id', \$updateParams)`."; |
|
85 | 85 | |
86 | 86 | throw new Exception\BadMethodCallException($msg); |
87 | 87 | } |
@@ -117,8 +117,8 @@ |
||
117 | 117 | public static function retrieve($_id, $_opts = null) |
118 | 118 | { |
119 | 119 | $msg = 'Tax IDs cannot be retrieved without a customer ID. Retrieve ' . |
120 | - "a tax ID using `Customer::retrieveTaxId('customer_id', " . |
|
121 | - "'tax_id_id')`."; |
|
120 | + "a tax ID using `Customer::retrieveTaxId('customer_id', " . |
|
121 | + "'tax_id_id')`."; |
|
122 | 122 | |
123 | 123 | throw new Exception\BadMethodCallException($msg); |
124 | 124 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (!$id) { |
100 | 100 | $class = static::class; |
101 | 101 | $msg = "Could not determine which URL to request: {$class} instance " |
102 | - . "has invalid ID: {$id}"; |
|
102 | + . "has invalid ID: {$id}"; |
|
103 | 103 | |
104 | 104 | throw new Exception\UnexpectedValueException($msg, null); |
105 | 105 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | return $this; |
117 | 117 | } |
118 | 118 | $message = 'This source object does not appear to be currently attached ' |
119 | - . 'to a customer object.'; |
|
119 | + . 'to a customer object.'; |
|
120 | 120 | |
121 | 121 | throw new Exception\UnexpectedValueException($message); |
122 | 122 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | public static function retrieve($_id, $_opts = null) |
112 | 112 | { |
113 | 113 | $msg = 'Cards cannot be retrieved without a customer ID or an ' . |
114 | - 'account ID. Retrieve a card using ' . |
|
115 | - "`Customer::retrieveSource('customer_id', 'card_id')` or " . |
|
116 | - "`Account::retrieveExternalAccount('account_id', 'card_id')`."; |
|
114 | + 'account ID. Retrieve a card using ' . |
|
115 | + "`Customer::retrieveSource('customer_id', 'card_id')` or " . |
|
116 | + "`Account::retrieveExternalAccount('account_id', 'card_id')`."; |
|
117 | 117 | |
118 | 118 | throw new Exception\BadMethodCallException($msg); |
119 | 119 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | public static function update($_id, $_params = null, $_options = null) |
129 | 129 | { |
130 | 130 | $msg = 'Cards cannot be updated without a customer ID or an ' . |
131 | - 'account ID. Update a card using ' . |
|
132 | - "`Customer::updateSource('customer_id', 'card_id', " . |
|
133 | - '$updateParams)` or `Account::updateExternalAccount(' . |
|
134 | - "'account_id', 'card_id', \$updateParams)`."; |
|
131 | + 'account ID. Update a card using ' . |
|
132 | + "`Customer::updateSource('customer_id', 'card_id', " . |
|
133 | + '$updateParams)` or `Account::updateExternalAccount(' . |
|
134 | + "'account_id', 'card_id', \$updateParams)`."; |
|
135 | 135 | |
136 | 136 | throw new Exception\BadMethodCallException($msg); |
137 | 137 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | */ |
1203 | 1203 | private function _getPageResources($obj) |
1204 | 1204 | { |
1205 | - // $obj = /Page |
|
1205 | + // $obj = /Page |
|
1206 | 1206 | $obj = $this->getObjectVal($obj); |
1207 | 1207 | |
1208 | 1208 | // If the current object has a resources |
@@ -1335,14 +1335,14 @@ discard block |
||
1335 | 1335 | if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { |
1336 | 1336 | $b =& $box[1]; |
1337 | 1337 | return array('x' => $b[0][1] / $k, |
1338 | - 'y' => $b[1][1] / $k, |
|
1339 | - 'w' => abs($b[0][1] - $b[2][1]) / $k, |
|
1340 | - 'h' => abs($b[1][1] - $b[3][1]) / $k, |
|
1341 | - 'llx' => min($b[0][1], $b[2][1]) / $k, |
|
1342 | - 'lly' => min($b[1][1], $b[3][1]) / $k, |
|
1343 | - 'urx' => max($b[0][1], $b[2][1]) / $k, |
|
1344 | - 'ury' => max($b[1][1], $b[3][1]) / $k, |
|
1345 | - ); |
|
1338 | + 'y' => $b[1][1] / $k, |
|
1339 | + 'w' => abs($b[0][1] - $b[2][1]) / $k, |
|
1340 | + 'h' => abs($b[1][1] - $b[3][1]) / $k, |
|
1341 | + 'llx' => min($b[0][1], $b[2][1]) / $k, |
|
1342 | + 'lly' => min($b[1][1], $b[3][1]) / $k, |
|
1343 | + 'urx' => max($b[0][1], $b[2][1]) / $k, |
|
1344 | + 'ury' => max($b[1][1], $b[3][1]) / $k, |
|
1345 | + ); |
|
1346 | 1346 | } elseif (!isset($page[1][1]['/Parent'])) { |
1347 | 1347 | return false; |
1348 | 1348 | } else { |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | |
1395 | 1395 | private function _getPageRotation($obj) |
1396 | 1396 | { |
1397 | - // $obj = /Page |
|
1397 | + // $obj = /Page |
|
1398 | 1398 | $obj = $this->getObjectVal($obj); |
1399 | 1399 | if (isset($obj[1][1]['/Rotate'])) { |
1400 | 1400 | $res = $this->getObjectVal($obj[1][1]['/Rotate']); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | } |
521 | 521 | } |
522 | 522 | } elseif ($filltrailer) { |
523 | - switch($key) { |
|
523 | + switch ($key) { |
|
524 | 524 | case '/Size': |
525 | 525 | case '/Root': |
526 | 526 | case '/Info': |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | protected function getRawObject($offset = 0, $data = null) |
713 | 713 | { |
714 | 714 | if ($data == null) { |
715 | - $data =& $this->pdfdata; |
|
715 | + $data = & $this->pdfdata; |
|
716 | 716 | } |
717 | 717 | $objtype = ''; // object type to be returned |
718 | 718 | $objval = ''; // object value to be returned |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | $objs = $streaminfo[0]; |
1021 | 1021 | if (!isset($this->objstreams[$objs[0]][$objs[1]])) { |
1022 | 1022 | // Fetch and decode object stream |
1023 | - $offset = $this->findObjectOffset($objs);; |
|
1023 | + $offset = $this->findObjectOffset($objs); ; |
|
1024 | 1024 | $objstream = $this->getObjectVal(array(PDF_TYPE_OBJREF, $objs[0], $objs[1])); |
1025 | 1025 | $decoded = $this->decodeStream($objstream[1][1], $objstream[2][1]); |
1026 | 1026 | $this->objstreams[$objs[0]][$objs[1]] = $decoded[0]; // Store just the data, in case we need more from this objstream |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | // Not a valid object stream dictionary - skip it. |
1056 | 1056 | return; |
1057 | 1057 | } |
1058 | - $stream = $this->decodeStream($obj[1][1], $obj[2][1]);// Decode object stream, as we need the first bit |
|
1058 | + $stream = $this->decodeStream($obj[1][1], $obj[2][1]); // Decode object stream, as we need the first bit |
|
1059 | 1059 | $first = intval($obj[1][1]['/First'][1]); |
1060 | 1060 | $ints = explode(' ', substr($stream[0], 0, $first)); // Get list of object / offset pairs |
1061 | 1061 | for ($j = 1; $j < count($ints); $j++) { |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | $this->objoffsets = array(); |
1079 | 1079 | if (preg_match_all('/(*ANYCRLF)^[\s]*([0-9]+)[\s]+([0-9]+)[\s]+obj/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE) >= 1) { |
1080 | 1080 | $i = 0; |
1081 | - foreach($matches[0] as $match) { |
|
1081 | + foreach ($matches[0] as $match) { |
|
1082 | 1082 | $offset = $match[1] + strspn($match[0], "\x00\x09\x0a\x0c\x0d\x20"); |
1083 | 1083 | $this->objoffsets[trim($match[0])] = $offset; |
1084 | 1084 | $dictoffset = $match[1] + strlen($match[0]); |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | |
1241 | 1241 | if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { |
1242 | 1242 | $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); |
1243 | - foreach($contents as $tmp_content) { |
|
1243 | + foreach ($contents as $tmp_content) { |
|
1244 | 1244 | $buffer .= $this->_rebuildContentStream($tmp_content) . ' '; |
1245 | 1245 | } |
1246 | 1246 | } |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | $page = $this->getObjectVal($page); |
1326 | 1326 | $box = null; |
1327 | 1327 | if (isset($page[1][1][$box_index])) |
1328 | - $box =& $page[1][1][$box_index]; |
|
1328 | + $box = & $page[1][1][$box_index]; |
|
1329 | 1329 | |
1330 | 1330 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
1331 | 1331 | $tmp_box = $this->getObjectVal($box); |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { |
1336 | - $b =& $box[1]; |
|
1336 | + $b = & $box[1]; |
|
1337 | 1337 | return array('x' => $b[0][1] / $k, |
1338 | 1338 | 'y' => $b[1][1] / $k, |
1339 | 1339 | 'w' => abs($b[0][1] - $b[2][1]) / $k, |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | { |
1373 | 1373 | $boxes = array(); |
1374 | 1374 | |
1375 | - foreach($this->availableBoxes as $box) { |
|
1375 | + foreach ($this->availableBoxes as $box) { |
|
1376 | 1376 | if ($_box = $this->getPageBox($page, $box, $k)) { |
1377 | 1377 | $boxes[$box] = $_box; |
1378 | 1378 | } |
@@ -49,35 +49,51 @@ discard block |
||
49 | 49 | */ |
50 | 50 | |
51 | 51 | // include class for decoding filters |
52 | -if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH') . '/include/tcpdf_filters.php'); |
|
53 | -else require_once(dirname(__FILE__) . '/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
52 | +if (defined('TCPDF_PATH')) { |
|
53 | + require_once(constant('TCPDF_PATH') . '/include/tcpdf_filters.php'); |
|
54 | +} else { |
|
55 | + require_once(dirname(__FILE__) . '/../tecnickcom/tcpdf/include/tcpdf_filters.php'); |
|
56 | +} |
|
54 | 57 | |
55 | -if (!defined('PDF_TYPE_NULL')) |
|
58 | +if (!defined('PDF_TYPE_NULL')) { |
|
56 | 59 | define('PDF_TYPE_NULL', 0); |
57 | -if (!defined('PDF_TYPE_NUMERIC')) |
|
60 | +} |
|
61 | +if (!defined('PDF_TYPE_NUMERIC')) { |
|
58 | 62 | define('PDF_TYPE_NUMERIC', 1); |
59 | -if (!defined('PDF_TYPE_TOKEN')) |
|
63 | +} |
|
64 | +if (!defined('PDF_TYPE_TOKEN')) { |
|
60 | 65 | define('PDF_TYPE_TOKEN', 2); |
61 | -if (!defined('PDF_TYPE_HEX')) |
|
66 | +} |
|
67 | +if (!defined('PDF_TYPE_HEX')) { |
|
62 | 68 | define('PDF_TYPE_HEX', 3); |
63 | -if (!defined('PDF_TYPE_STRING')) |
|
69 | +} |
|
70 | +if (!defined('PDF_TYPE_STRING')) { |
|
64 | 71 | define('PDF_TYPE_STRING', 4); |
65 | -if (!defined('PDF_TYPE_DICTIONARY')) |
|
72 | +} |
|
73 | +if (!defined('PDF_TYPE_DICTIONARY')) { |
|
66 | 74 | define('PDF_TYPE_DICTIONARY', 5); |
67 | -if (!defined('PDF_TYPE_ARRAY')) |
|
75 | +} |
|
76 | +if (!defined('PDF_TYPE_ARRAY')) { |
|
68 | 77 | define('PDF_TYPE_ARRAY', 6); |
69 | -if (!defined('PDF_TYPE_OBJDEC')) |
|
78 | +} |
|
79 | +if (!defined('PDF_TYPE_OBJDEC')) { |
|
70 | 80 | define('PDF_TYPE_OBJDEC', 7); |
71 | -if (!defined('PDF_TYPE_OBJREF')) |
|
81 | +} |
|
82 | +if (!defined('PDF_TYPE_OBJREF')) { |
|
72 | 83 | define('PDF_TYPE_OBJREF', 8); |
73 | -if (!defined('PDF_TYPE_OBJECT')) |
|
84 | +} |
|
85 | +if (!defined('PDF_TYPE_OBJECT')) { |
|
74 | 86 | define('PDF_TYPE_OBJECT', 9); |
75 | -if (!defined('PDF_TYPE_STREAM')) |
|
87 | +} |
|
88 | +if (!defined('PDF_TYPE_STREAM')) { |
|
76 | 89 | define('PDF_TYPE_STREAM', 10); |
77 | -if (!defined('PDF_TYPE_BOOLEAN')) |
|
90 | +} |
|
91 | +if (!defined('PDF_TYPE_BOOLEAN')) { |
|
78 | 92 | define('PDF_TYPE_BOOLEAN', 11); |
79 | -if (!defined('PDF_TYPE_REAL')) |
|
93 | +} |
|
94 | +if (!defined('PDF_TYPE_REAL')) { |
|
80 | 95 | define('PDF_TYPE_REAL', 12); |
96 | +} |
|
81 | 97 | |
82 | 98 | /** |
83 | 99 | * @class tcpdi_parser |
@@ -251,8 +267,9 @@ discard block |
||
251 | 267 | public function getPDFVersion() |
252 | 268 | { |
253 | 269 | preg_match('/\d\.\d/', substr($this->pdfdata, 0, 16), $m); |
254 | - if (isset($m[0])) |
|
255 | - $this->pdfVersion = $m[0]; |
|
270 | + if (isset($m[0])) { |
|
271 | + $this->pdfVersion = $m[0]; |
|
272 | + } |
|
256 | 273 | return $this->pdfVersion; |
257 | 274 | } |
258 | 275 | |
@@ -1211,16 +1228,18 @@ discard block |
||
1211 | 1228 | // parent object. |
1212 | 1229 | if (isset($obj[1][1]['/Resources'])) { |
1213 | 1230 | $res = $obj[1][1]['/Resources']; |
1214 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
1215 | - return $res[1]; |
|
1231 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
1232 | + return $res[1]; |
|
1233 | + } |
|
1216 | 1234 | return $res; |
1217 | 1235 | } else { |
1218 | 1236 | if (!isset($obj[1][1]['/Parent'])) { |
1219 | 1237 | return false; |
1220 | 1238 | } else { |
1221 | 1239 | $res = $this->_getPageResources($obj[1][1]['/Parent']); |
1222 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
1223 | - return $res[1]; |
|
1240 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
1241 | + return $res[1]; |
|
1242 | + } |
|
1224 | 1243 | return $res; |
1225 | 1244 | } |
1226 | 1245 | } |
@@ -1324,8 +1343,9 @@ discard block |
||
1324 | 1343 | { |
1325 | 1344 | $page = $this->getObjectVal($page); |
1326 | 1345 | $box = null; |
1327 | - if (isset($page[1][1][$box_index])) |
|
1328 | - $box =& $page[1][1][$box_index]; |
|
1346 | + if (isset($page[1][1][$box_index])) { |
|
1347 | + $box =& $page[1][1][$box_index]; |
|
1348 | + } |
|
1329 | 1349 | |
1330 | 1350 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
1331 | 1351 | $tmp_box = $this->getObjectVal($box); |
@@ -1398,16 +1418,18 @@ discard block |
||
1398 | 1418 | $obj = $this->getObjectVal($obj); |
1399 | 1419 | if (isset($obj[1][1]['/Rotate'])) { |
1400 | 1420 | $res = $this->getObjectVal($obj[1][1]['/Rotate']); |
1401 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
1402 | - return $res[1]; |
|
1421 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
1422 | + return $res[1]; |
|
1423 | + } |
|
1403 | 1424 | return $res; |
1404 | 1425 | } else { |
1405 | 1426 | if (!isset($obj[1][1]['/Parent'])) { |
1406 | 1427 | return false; |
1407 | 1428 | } else { |
1408 | 1429 | $res = $this->_getPageRotation($obj[1][1]['/Parent']); |
1409 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
1410 | - return $res[1]; |
|
1430 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
1431 | + return $res[1]; |
|
1432 | + } |
|
1411 | 1433 | return $res; |
1412 | 1434 | } |
1413 | 1435 | } |
@@ -336,7 +336,7 @@ |
||
336 | 336 | switch($tpl['_rotationAngle']) { |
337 | 337 | case -90: |
338 | 338 | $tx = -$tpl['box']['lly']; |
339 | - $ty = $tpl['box']['urx']; |
|
339 | + $ty = $tpl['box']['urx']; |
|
340 | 340 | break; |
341 | 341 | case -180: |
342 | 342 | $tx = $tpl['box']['urx']; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | if (!isset($this->parsers[$filename])) |
93 | 93 | $this->parsers[$filename] = $this->_getPdfParser($filename); |
94 | - $this->current_parser =& $this->parsers[$filename]; |
|
94 | + $this->current_parser = & $this->parsers[$filename]; |
|
95 | 95 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
96 | 96 | |
97 | 97 | return $this->parsers[$filename]->getPageCount(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | if (!isset($this->parsers[$filename])) |
112 | 112 | $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
113 | - $this->current_parser =& $this->parsers[$filename]; |
|
113 | + $this->current_parser = & $this->parsers[$filename]; |
|
114 | 114 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
115 | 115 | |
116 | 116 | return $this->parsers[$filename]->getPageCount(); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | $fn = $this->current_filename; |
164 | 164 | |
165 | 165 | // check if page already imported |
166 | - $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
|
166 | + $pageKey = $fn . '-' . ((int) $pageno) . $boxName; |
|
167 | 167 | if (isset($this->_importedPages[$pageKey])) |
168 | 168 | return $this->_importedPages[$pageKey]; |
169 | 169 | |
170 | - $parser =& $this->parsers[$fn]; |
|
170 | + $parser = & $this->parsers[$fn]; |
|
171 | 171 | $parser->setPageno($pageno); |
172 | 172 | |
173 | 173 | if (!in_array($boxName, $parser->availableBoxes)) |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | |
197 | 197 | $this->tpl++; |
198 | 198 | $this->tpls[$this->tpl] = array(); |
199 | - $tpl =& $this->tpls[$this->tpl]; |
|
200 | - $tpl['parser'] =& $parser; |
|
199 | + $tpl = & $this->tpls[$this->tpl]; |
|
200 | + $tpl['parser'] = & $parser; |
|
201 | 201 | $tpl['resources'] = $parser->getPageResources(); |
202 | 202 | $tpl['buffer'] = $parser->getContent(); |
203 | 203 | $tpl['box'] = $box; |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | function _putimportedobjects() |
266 | 266 | { |
267 | 267 | if (is_array($this->parsers) && count($this->parsers) > 0) { |
268 | - foreach($this->parsers as $filename => $p) { |
|
269 | - $this->current_parser =& $this->parsers[$filename]; |
|
268 | + foreach ($this->parsers as $filename => $p) { |
|
269 | + $this->current_parser = & $this->parsers[$filename]; |
|
270 | 270 | if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { |
271 | - while(($n = key($this->_obj_stack[$filename])) !== null) { |
|
271 | + while (($n = key($this->_obj_stack[$filename])) !== null) { |
|
272 | 272 | $nObj = $this->current_parser->getObjectVal($this->_obj_stack[$filename][$n][1]); |
273 | 273 | |
274 | 274 | $this->_newobj($this->_obj_stack[$filename][$n][0]); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | { |
302 | 302 | $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
303 | 303 | reset($this->tpls); |
304 | - foreach($this->tpls as $tplidx => $tpl) { |
|
304 | + foreach ($this->tpls as $tplidx => $tpl) { |
|
305 | 305 | $p = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; |
306 | 306 | $this->_newobj(); |
307 | 307 | $cN = $this->n; // TCPDF/Protection: rem current "n" |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $c = cos($angle); |
334 | 334 | $s = sin($angle); |
335 | 335 | |
336 | - switch($tpl['_rotationAngle']) { |
|
336 | + switch ($tpl['_rotationAngle']) { |
|
337 | 337 | case -90: |
338 | 338 | $tx = -$tpl['box']['lly']; |
339 | 339 | $ty = $tpl['box']['urx']; |
@@ -366,28 +366,28 @@ discard block |
||
366 | 366 | $this->_out('/Resources '); |
367 | 367 | |
368 | 368 | if (isset($tpl['resources'])) { |
369 | - $this->current_parser =& $tpl['parser']; |
|
369 | + $this->current_parser = & $tpl['parser']; |
|
370 | 370 | $this->pdf_write_value($tpl['resources']); // "n" will be changed |
371 | 371 | } else { |
372 | 372 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
373 | 373 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
374 | 374 | $this->_out('/Font <<'); |
375 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
375 | + foreach ($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
376 | 376 | $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
377 | 377 | $this->_out('>>'); |
378 | 378 | } |
379 | - if( |
|
379 | + if ( |
|
380 | 380 | isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
381 | 381 | isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']) |
382 | 382 | ) |
383 | 383 | { |
384 | 384 | $this->_out('/XObject <<'); |
385 | 385 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
386 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
386 | + foreach ($this->_res['tpl'][$tplidx]['images'] as $image) |
|
387 | 387 | $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
388 | 388 | } |
389 | 389 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
390 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
390 | + foreach ($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
391 | 391 | $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
392 | 392 | } |
393 | 393 | $this->_out('>>'); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | case PDF_TYPE_OBJREF: |
511 | 511 | // An indirect object reference |
512 | 512 | // Fill the object stack if needed |
513 | - $cpfn =& $this->current_parser->uniqueid; |
|
513 | + $cpfn = & $this->current_parser->uniqueid; |
|
514 | 514 | |
515 | 515 | if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { |
516 | 516 | $this->_newobj(false, true); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | function cleanUp() |
610 | 610 | { |
611 | - foreach ($this->parsers as $k => $_){ |
|
611 | + foreach ($this->parsers as $k => $_) { |
|
612 | 612 | $this->parsers[$k]->cleanUp(); |
613 | 613 | $this->parsers[$k] = null; |
614 | 614 | unset($this->parsers[$k]); |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | { |
626 | 626 | $out = parent::_getxobjectdict(); |
627 | 627 | if (count($this->tpls)) { |
628 | - foreach($this->tpls as $tplidx => $tpl) { |
|
628 | + foreach ($this->tpls as $tplidx => $tpl) { |
|
629 | 629 | $out .= sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']); |
630 | 630 | } |
631 | 631 | } |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | { |
90 | 90 | $this->current_filename = $filename; |
91 | 91 | |
92 | - if (!isset($this->parsers[$filename])) |
|
93 | - $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
92 | + if (!isset($this->parsers[$filename])) { |
|
93 | + $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
94 | + } |
|
94 | 95 | $this->current_parser =& $this->parsers[$filename]; |
95 | 96 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
96 | 97 | |
@@ -108,8 +109,9 @@ discard block |
||
108 | 109 | $filename = uniqid('tcpdi-'); |
109 | 110 | $this->current_filename = $filename; |
110 | 111 | |
111 | - if (!isset($this->parsers[$filename])) |
|
112 | - $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
112 | + if (!isset($this->parsers[$filename])) { |
|
113 | + $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
114 | + } |
|
113 | 115 | $this->current_parser =& $this->parsers[$filename]; |
114 | 116 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
115 | 117 | |
@@ -164,14 +166,16 @@ discard block |
||
164 | 166 | |
165 | 167 | // check if page already imported |
166 | 168 | $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
167 | - if (isset($this->_importedPages[$pageKey])) |
|
168 | - return $this->_importedPages[$pageKey]; |
|
169 | + if (isset($this->_importedPages[$pageKey])) { |
|
170 | + return $this->_importedPages[$pageKey]; |
|
171 | + } |
|
169 | 172 | |
170 | 173 | $parser =& $this->parsers[$fn]; |
171 | 174 | $parser->setPageno($pageno); |
172 | 175 | |
173 | - if (!in_array($boxName, $parser->availableBoxes)) |
|
174 | - return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
176 | + if (!in_array($boxName, $parser->availableBoxes)) { |
|
177 | + return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
178 | + } |
|
175 | 179 | |
176 | 180 | $pageboxes = $parser->getPageBoxes($pageno, $this->k); |
177 | 181 | |
@@ -182,13 +186,16 @@ discard block |
||
182 | 186 | * TrimBox: Default -> CropBox |
183 | 187 | * ArtBox: Default -> CropBox |
184 | 188 | */ |
185 | - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) |
|
186 | - $boxName = '/CropBox'; |
|
187 | - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') |
|
188 | - $boxName = '/MediaBox'; |
|
189 | + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) { |
|
190 | + $boxName = '/CropBox'; |
|
191 | + } |
|
192 | + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') { |
|
193 | + $boxName = '/MediaBox'; |
|
194 | + } |
|
189 | 195 | |
190 | - if (!isset($pageboxes[$boxName])) |
|
191 | - return false; |
|
196 | + if (!isset($pageboxes[$boxName])) { |
|
197 | + return false; |
|
198 | + } |
|
192 | 199 | |
193 | 200 | $this->lastUsedPageBox = $boxName; |
194 | 201 | |
@@ -220,8 +227,9 @@ discard block |
||
220 | 227 | $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; |
221 | 228 | $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; |
222 | 229 | |
223 | - if ($angle < 0) |
|
224 | - $angle += 360; |
|
230 | + if ($angle < 0) { |
|
231 | + $angle += 360; |
|
232 | + } |
|
225 | 233 | |
226 | 234 | $tpl['_rotationAngle'] = $angle * -1; |
227 | 235 | } |
@@ -372,8 +380,9 @@ discard block |
||
372 | 380 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
373 | 381 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
374 | 382 | $this->_out('/Font <<'); |
375 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
376 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
383 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
384 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
385 | + } |
|
377 | 386 | $this->_out('>>'); |
378 | 387 | } |
379 | 388 | if( |
@@ -383,12 +392,14 @@ discard block |
||
383 | 392 | { |
384 | 393 | $this->_out('/XObject <<'); |
385 | 394 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
386 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
387 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
395 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
396 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
397 | + } |
|
388 | 398 | } |
389 | 399 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
390 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
391 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
400 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
401 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
402 | + } |
|
392 | 403 | } |
393 | 404 | $this->_out('>>'); |
394 | 405 | } |
@@ -668,8 +679,9 @@ discard block |
||
668 | 679 | $out .= chr(0x0A); |
669 | 680 | break; |
670 | 681 | case "\r": |
671 | - if ($count != $n - 1 && $s[$count + 1] == "\n") |
|
672 | - $count++; |
|
682 | + if ($count != $n - 1 && $s[$count + 1] == "\n") { |
|
683 | + $count++; |
|
684 | + } |
|
673 | 685 | break; |
674 | 686 | case "\n": |
675 | 687 | break; |
@@ -412,7 +412,7 @@ |
||
412 | 412 | $this->_out('/XObject <<'); |
413 | 413 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
414 | 414 | foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
415 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
415 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
416 | 416 | } |
417 | 417 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
418 | 418 | foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | // Save settings |
98 | 98 | $this->tpl++; |
99 | - $tpl =& $this->tpls[$this->tpl]; |
|
99 | + $tpl = & $this->tpls[$this->tpl]; |
|
100 | 100 | $tpl = array( |
101 | 101 | 'o_x' => $this->x, |
102 | 102 | 'o_y' => $this->y, |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | if ($this->CurrentFont) { |
132 | 132 | $fontkey = $this->FontFamily . $this->FontStyle; |
133 | - $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; |
|
133 | + $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] = & $this->fonts[$fontkey]; |
|
134 | 134 | |
135 | 135 | $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); |
136 | 136 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | if ($this->_intpl) { |
156 | 156 | $this->_intpl = false; |
157 | - $tpl =& $this->tpls[$this->tpl]; |
|
157 | + $tpl = & $this->tpls[$this->tpl]; |
|
158 | 158 | $this->SetXY($tpl['o_x'], $tpl['o_y']); |
159 | 159 | $this->tMargin = $tpl['o_tMargin']; |
160 | 160 | $this->lMargin = $tpl['o_lMargin']; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $fontkey = $this->FontFamily . $this->FontStyle; |
172 | 172 | if ($fontkey) |
173 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
173 | + $this->CurrentFont = & $this->fonts[$fontkey]; |
|
174 | 174 | |
175 | 175 | return $this->tpl; |
176 | 176 | } else { |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | $this->error('Template does not exist!'); |
205 | 205 | |
206 | 206 | if ($this->_intpl) { |
207 | - $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
|
207 | + $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] = & $this->tpls[$tplidx]; |
|
208 | 208 | } |
209 | 209 | |
210 | - $tpl =& $this->tpls[$tplidx]; |
|
210 | + $tpl = & $this->tpls[$tplidx]; |
|
211 | 211 | $w = $tpl['w']; |
212 | 212 | $h = $tpl['h']; |
213 | 213 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | if (!isset($this->tpls[$tplidx])) |
259 | 259 | return false; |
260 | 260 | |
261 | - $tpl =& $this->tpls[$tplidx]; |
|
261 | + $tpl = & $this->tpls[$tplidx]; |
|
262 | 262 | $w = $tpl['w']; |
263 | 263 | $h = $tpl['h']; |
264 | 264 | |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | $_h = $h; |
268 | 268 | } |
269 | 269 | |
270 | - if($_w == 0) |
|
270 | + if ($_w == 0) |
|
271 | 271 | $_w = $_h * $w / $h; |
272 | - if($_h == 0) |
|
272 | + if ($_h == 0) |
|
273 | 273 | $_h = $_w * $h / $w; |
274 | 274 | |
275 | 275 | return array("w" => $_w, "h" => $_h); |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | $fontkey = $this->FontFamily . $this->FontStyle; |
291 | 291 | |
292 | 292 | if ($this->_intpl) { |
293 | - $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; |
|
293 | + $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] = & $this->fonts[$fontkey]; |
|
294 | 294 | } else { |
295 | - $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; |
|
295 | + $this->_res['page'][$this->page]['fonts'][$fontkey] = & $this->fonts[$fontkey]; |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | |
328 | 328 | $ret = parent::Image($file, $x, $y, $w, $h, $type, $link); |
329 | 329 | if ($this->_intpl) { |
330 | - $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; |
|
330 | + $this->_res['tpl'][$this->tpl]['images'][$file] = & $this->images[$file]; |
|
331 | 331 | } else { |
332 | - $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; |
|
332 | + $this->_res['page'][$this->page]['images'][$file] = & $this->images[$file]; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | return $ret; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | { |
401 | 401 | $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
402 | 402 | reset($this->tpls); |
403 | - foreach($this->tpls as $tplidx => $tpl) { |
|
403 | + foreach ($this->tpls as $tplidx => $tpl) { |
|
404 | 404 | $p = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; |
405 | 405 | $this->_newobj(); |
406 | 406 | $this->tpls[$tplidx]['n'] = $this->n; |
@@ -431,22 +431,22 @@ discard block |
||
431 | 431 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
432 | 432 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
433 | 433 | $this->_out('/Font <<'); |
434 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
434 | + foreach ($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
435 | 435 | $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
436 | 436 | $this->_out('>>'); |
437 | 437 | } |
438 | - if( |
|
438 | + if ( |
|
439 | 439 | isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
440 | 440 | isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']) |
441 | 441 | ) |
442 | 442 | { |
443 | 443 | $this->_out('/XObject <<'); |
444 | 444 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
445 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
445 | + foreach ($this->_res['tpl'][$tplidx]['images'] as $image) |
|
446 | 446 | $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
447 | 447 | } |
448 | 448 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
449 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
449 | + foreach ($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
450 | 450 | $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
451 | 451 | } |
452 | 452 | $this->_out('>>'); |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | parent::_putxobjectdict(); |
475 | 475 | |
476 | 476 | if (count($this->tpls)) { |
477 | - foreach($this->tpls as $tplidx => $tpl) { |
|
477 | + foreach ($this->tpls as $tplidx => $tpl) { |
|
478 | 478 | $this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n'])); |
479 | 479 | } |
480 | 480 | } |
@@ -82,17 +82,22 @@ discard block |
||
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - if ($this->page <= 0) |
|
86 | - $this->error("You have to add a page to fpdf first!"); |
|
85 | + if ($this->page <= 0) { |
|
86 | + $this->error("You have to add a page to fpdf first!"); |
|
87 | + } |
|
87 | 88 | |
88 | - if ($x == null) |
|
89 | - $x = 0; |
|
90 | - if ($y == null) |
|
91 | - $y = 0; |
|
92 | - if ($w == null) |
|
93 | - $w = $this->w; |
|
94 | - if ($h == null) |
|
95 | - $h = $this->h; |
|
89 | + if ($x == null) { |
|
90 | + $x = 0; |
|
91 | + } |
|
92 | + if ($y == null) { |
|
93 | + $y = 0; |
|
94 | + } |
|
95 | + if ($w == null) { |
|
96 | + $w = $this->w; |
|
97 | + } |
|
98 | + if ($h == null) { |
|
99 | + $h = $this->h; |
|
100 | + } |
|
96 | 101 | |
97 | 102 | // Save settings |
98 | 103 | $this->tpl++; |
@@ -169,8 +174,9 @@ discard block |
||
169 | 174 | $this->FontSize = $tpl['o_FontSize']; |
170 | 175 | |
171 | 176 | $fontkey = $this->FontFamily . $this->FontStyle; |
172 | - if ($fontkey) |
|
173 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
177 | + if ($fontkey) { |
|
178 | + $this->CurrentFont =& $this->fonts[$fontkey]; |
|
179 | + } |
|
174 | 180 | |
175 | 181 | return $this->tpl; |
176 | 182 | } else { |
@@ -197,11 +203,13 @@ discard block |
||
197 | 203 | */ |
198 | 204 | function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) |
199 | 205 | { |
200 | - if ($this->page <= 0) |
|
201 | - $this->error('You have to add a page first!'); |
|
206 | + if ($this->page <= 0) { |
|
207 | + $this->error('You have to add a page first!'); |
|
208 | + } |
|
202 | 209 | |
203 | - if (!isset($this->tpls[$tplidx])) |
|
204 | - $this->error('Template does not exist!'); |
|
210 | + if (!isset($this->tpls[$tplidx])) { |
|
211 | + $this->error('Template does not exist!'); |
|
212 | + } |
|
205 | 213 | |
206 | 214 | if ($this->_intpl) { |
207 | 215 | $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
@@ -211,10 +219,12 @@ discard block |
||
211 | 219 | $w = $tpl['w']; |
212 | 220 | $h = $tpl['h']; |
213 | 221 | |
214 | - if ($_x == null) |
|
215 | - $_x = 0; |
|
216 | - if ($_y == null) |
|
217 | - $_y = 0; |
|
222 | + if ($_x == null) { |
|
223 | + $_x = 0; |
|
224 | + } |
|
225 | + if ($_y == null) { |
|
226 | + $_y = 0; |
|
227 | + } |
|
218 | 228 | |
219 | 229 | $_x += $tpl['x']; |
220 | 230 | $_y += $tpl['y']; |
@@ -255,8 +265,9 @@ discard block |
||
255 | 265 | */ |
256 | 266 | function getTemplateSize($tplidx, $_w = 0, $_h = 0) |
257 | 267 | { |
258 | - if (!isset($this->tpls[$tplidx])) |
|
259 | - return false; |
|
268 | + if (!isset($this->tpls[$tplidx])) { |
|
269 | + return false; |
|
270 | + } |
|
260 | 271 | |
261 | 272 | $tpl =& $this->tpls[$tplidx]; |
262 | 273 | $w = $tpl['w']; |
@@ -267,10 +278,12 @@ discard block |
||
267 | 278 | $_h = $h; |
268 | 279 | } |
269 | 280 | |
270 | - if($_w == 0) |
|
271 | - $_w = $_h * $w / $h; |
|
272 | - if($_h == 0) |
|
273 | - $_h = $_w * $h / $w; |
|
281 | + if($_w == 0) { |
|
282 | + $_w = $_h * $w / $h; |
|
283 | + } |
|
284 | + if($_h == 0) { |
|
285 | + $_h = $_w * $h / $w; |
|
286 | + } |
|
274 | 287 | |
275 | 288 | return array("w" => $_w, "h" => $_h); |
276 | 289 | } |
@@ -347,8 +360,9 @@ discard block |
||
347 | 360 | return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); |
348 | 361 | } |
349 | 362 | |
350 | - if ($this->_intpl) |
|
351 | - $this->Error('Adding pages in templates isn\'t possible!'); |
|
363 | + if ($this->_intpl) { |
|
364 | + $this->Error('Adding pages in templates isn\'t possible!'); |
|
365 | + } |
|
352 | 366 | |
353 | 367 | parent::AddPage($orientation, $format); |
354 | 368 | } |
@@ -363,8 +377,9 @@ discard block |
||
363 | 377 | return call_user_func_array(array($this, 'TCPDF::Link'), $args); |
364 | 378 | } |
365 | 379 | |
366 | - if ($this->_intpl) |
|
367 | - $this->Error('Using links in templates aren\'t possible!'); |
|
380 | + if ($this->_intpl) { |
|
381 | + $this->Error('Using links in templates aren\'t possible!'); |
|
382 | + } |
|
368 | 383 | |
369 | 384 | parent::Link($x, $y, $w, $h, $link); |
370 | 385 | } |
@@ -376,8 +391,9 @@ discard block |
||
376 | 391 | return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); |
377 | 392 | } |
378 | 393 | |
379 | - if ($this->_intpl) |
|
380 | - $this->Error('Adding links in templates aren\'t possible!'); |
|
394 | + if ($this->_intpl) { |
|
395 | + $this->Error('Adding links in templates aren\'t possible!'); |
|
396 | + } |
|
381 | 397 | return parent::AddLink(); |
382 | 398 | } |
383 | 399 | |
@@ -388,8 +404,9 @@ discard block |
||
388 | 404 | return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); |
389 | 405 | } |
390 | 406 | |
391 | - if ($this->_intpl) |
|
392 | - $this->Error('Setting links in templates aren\'t possible!'); |
|
407 | + if ($this->_intpl) { |
|
408 | + $this->Error('Setting links in templates aren\'t possible!'); |
|
409 | + } |
|
393 | 410 | parent::SetLink($link, $y, $page); |
394 | 411 | } |
395 | 412 | |
@@ -431,8 +448,9 @@ discard block |
||
431 | 448 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
432 | 449 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
433 | 450 | $this->_out('/Font <<'); |
434 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
435 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
451 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
452 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
453 | + } |
|
436 | 454 | $this->_out('>>'); |
437 | 455 | } |
438 | 456 | if( |
@@ -442,12 +460,14 @@ discard block |
||
442 | 460 | { |
443 | 461 | $this->_out('/XObject <<'); |
444 | 462 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
445 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
446 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
463 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
464 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
465 | + } |
|
447 | 466 | } |
448 | 467 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
449 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
450 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
468 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
469 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
470 | + } |
|
451 | 471 | } |
452 | 472 | $this->_out('>>'); |
453 | 473 | } |