@@ -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 | |
@@ -1186,16 +1203,18 @@ discard block |
||
1186 | 1203 | // parent object. |
1187 | 1204 | if (isset ($obj[1][1]['/Resources'])) { |
1188 | 1205 | $res = $obj[1][1]['/Resources']; |
1189 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
1190 | - return $res[1]; |
|
1206 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
1207 | + return $res[1]; |
|
1208 | + } |
|
1191 | 1209 | return $res; |
1192 | 1210 | } else { |
1193 | 1211 | if (!isset ($obj[1][1]['/Parent'])) { |
1194 | 1212 | return false; |
1195 | 1213 | } else { |
1196 | 1214 | $res = $this->_getPageResources($obj[1][1]['/Parent']); |
1197 | - if ($res[0] == PDF_TYPE_OBJECT) |
|
1198 | - return $res[1]; |
|
1215 | + if ($res[0] == PDF_TYPE_OBJECT) { |
|
1216 | + return $res[1]; |
|
1217 | + } |
|
1199 | 1218 | return $res; |
1200 | 1219 | } |
1201 | 1220 | } |
@@ -1295,8 +1314,9 @@ discard block |
||
1295 | 1314 | public function getPageBox($page, $box_index, $k) { |
1296 | 1315 | $page = $this->getObjectVal($page); |
1297 | 1316 | $box = null; |
1298 | - if (isset($page[1][1][$box_index])) |
|
1299 | - $box =& $page[1][1][$box_index]; |
|
1317 | + if (isset($page[1][1][$box_index])) { |
|
1318 | + $box =& $page[1][1][$box_index]; |
|
1319 | + } |
|
1300 | 1320 | |
1301 | 1321 | if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { |
1302 | 1322 | $tmp_box = $this->getObjectVal($box); |
@@ -1364,16 +1384,18 @@ discard block |
||
1364 | 1384 | $obj = $this->getObjectVal($obj); |
1365 | 1385 | if (isset ($obj[1][1]['/Rotate'])) { |
1366 | 1386 | $res = $this->getObjectVal($obj[1][1]['/Rotate']); |
1367 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
1368 | - return $res[1]; |
|
1387 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
1388 | + return $res[1]; |
|
1389 | + } |
|
1369 | 1390 | return $res; |
1370 | 1391 | } else { |
1371 | 1392 | if (!isset ($obj[1][1]['/Parent'])) { |
1372 | 1393 | return false; |
1373 | 1394 | } else { |
1374 | 1395 | $res = $this->_getPageRotation($obj[1][1]['/Parent']); |
1375 | - if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) |
|
1376 | - return $res[1]; |
|
1396 | + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) { |
|
1397 | + return $res[1]; |
|
1398 | + } |
|
1377 | 1399 | return $res; |
1378 | 1400 | } |
1379 | 1401 | } |
@@ -79,17 +79,22 @@ discard block |
||
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - if ($this->page <= 0) |
|
83 | - $this->error("You have to add a page to fpdf first!"); |
|
82 | + if ($this->page <= 0) { |
|
83 | + $this->error("You have to add a page to fpdf first!"); |
|
84 | + } |
|
84 | 85 | |
85 | - if ($x == null) |
|
86 | - $x = 0; |
|
87 | - if ($y == null) |
|
88 | - $y = 0; |
|
89 | - if ($w == null) |
|
90 | - $w = $this->w; |
|
91 | - if ($h == null) |
|
92 | - $h = $this->h; |
|
86 | + if ($x == null) { |
|
87 | + $x = 0; |
|
88 | + } |
|
89 | + if ($y == null) { |
|
90 | + $y = 0; |
|
91 | + } |
|
92 | + if ($w == null) { |
|
93 | + $w = $this->w; |
|
94 | + } |
|
95 | + if ($h == null) { |
|
96 | + $h = $this->h; |
|
97 | + } |
|
93 | 98 | |
94 | 99 | // Save settings |
95 | 100 | $this->tpl++; |
@@ -165,8 +170,9 @@ discard block |
||
165 | 170 | $this->FontSize = $tpl['o_FontSize']; |
166 | 171 | |
167 | 172 | $fontkey = $this->FontFamily . $this->FontStyle; |
168 | - if ($fontkey) |
|
169 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
173 | + if ($fontkey) { |
|
174 | + $this->CurrentFont =& $this->fonts[$fontkey]; |
|
175 | + } |
|
170 | 176 | |
171 | 177 | return $this->tpl; |
172 | 178 | } else { |
@@ -192,11 +198,13 @@ discard block |
||
192 | 198 | * @retrun array The height and width of the template |
193 | 199 | */ |
194 | 200 | function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { |
195 | - if ($this->page <= 0) |
|
196 | - $this->error('You have to add a page first!'); |
|
201 | + if ($this->page <= 0) { |
|
202 | + $this->error('You have to add a page first!'); |
|
203 | + } |
|
197 | 204 | |
198 | - if (!isset($this->tpls[$tplidx])) |
|
199 | - $this->error('Template does not exist!'); |
|
205 | + if (!isset($this->tpls[$tplidx])) { |
|
206 | + $this->error('Template does not exist!'); |
|
207 | + } |
|
200 | 208 | |
201 | 209 | if ($this->_intpl) { |
202 | 210 | $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
@@ -206,10 +214,12 @@ discard block |
||
206 | 214 | $w = $tpl['w']; |
207 | 215 | $h = $tpl['h']; |
208 | 216 | |
209 | - if ($_x == null) |
|
210 | - $_x = 0; |
|
211 | - if ($_y == null) |
|
212 | - $_y = 0; |
|
217 | + if ($_x == null) { |
|
218 | + $_x = 0; |
|
219 | + } |
|
220 | + if ($_y == null) { |
|
221 | + $_y = 0; |
|
222 | + } |
|
213 | 223 | |
214 | 224 | $_x += $tpl['x']; |
215 | 225 | $_y += $tpl['y']; |
@@ -249,8 +259,9 @@ discard block |
||
249 | 259 | * @return array The height and width of the template |
250 | 260 | */ |
251 | 261 | function getTemplateSize($tplidx, $_w = 0, $_h = 0) { |
252 | - if (!isset($this->tpls[$tplidx])) |
|
253 | - return false; |
|
262 | + if (!isset($this->tpls[$tplidx])) { |
|
263 | + return false; |
|
264 | + } |
|
254 | 265 | |
255 | 266 | $tpl =& $this->tpls[$tplidx]; |
256 | 267 | $w = $tpl['w']; |
@@ -261,10 +272,12 @@ discard block |
||
261 | 272 | $_h = $h; |
262 | 273 | } |
263 | 274 | |
264 | - if($_w == 0) |
|
265 | - $_w = $_h * $w / $h; |
|
266 | - if($_h == 0) |
|
267 | - $_h = $_w * $h / $w; |
|
275 | + if($_w == 0) { |
|
276 | + $_w = $_h * $w / $h; |
|
277 | + } |
|
278 | + if($_h == 0) { |
|
279 | + $_h = $_w * $h / $w; |
|
280 | + } |
|
268 | 281 | |
269 | 282 | return array("w" => $_w, "h" => $_h); |
270 | 283 | } |
@@ -323,8 +336,9 @@ discard block |
||
323 | 336 | return call_user_func_array(array($this, 'TCPDF::AddPage'), $args); |
324 | 337 | } |
325 | 338 | |
326 | - if ($this->_intpl) |
|
327 | - $this->Error('Adding pages in templates isn\'t possible!'); |
|
339 | + if ($this->_intpl) { |
|
340 | + $this->Error('Adding pages in templates isn\'t possible!'); |
|
341 | + } |
|
328 | 342 | |
329 | 343 | parent::AddPage($orientation, $format); |
330 | 344 | } |
@@ -338,8 +352,9 @@ discard block |
||
338 | 352 | return call_user_func_array(array($this, 'TCPDF::Link'), $args); |
339 | 353 | } |
340 | 354 | |
341 | - if ($this->_intpl) |
|
342 | - $this->Error('Using links in templates aren\'t possible!'); |
|
355 | + if ($this->_intpl) { |
|
356 | + $this->Error('Using links in templates aren\'t possible!'); |
|
357 | + } |
|
343 | 358 | |
344 | 359 | parent::Link($x, $y, $w, $h, $link); |
345 | 360 | } |
@@ -350,8 +365,9 @@ discard block |
||
350 | 365 | return call_user_func_array(array($this, 'TCPDF::AddLink'), $args); |
351 | 366 | } |
352 | 367 | |
353 | - if ($this->_intpl) |
|
354 | - $this->Error('Adding links in templates aren\'t possible!'); |
|
368 | + if ($this->_intpl) { |
|
369 | + $this->Error('Adding links in templates aren\'t possible!'); |
|
370 | + } |
|
355 | 371 | return parent::AddLink(); |
356 | 372 | } |
357 | 373 | |
@@ -361,8 +377,9 @@ discard block |
||
361 | 377 | return call_user_func_array(array($this, 'TCPDF::SetLink'), $args); |
362 | 378 | } |
363 | 379 | |
364 | - if ($this->_intpl) |
|
365 | - $this->Error('Setting links in templates aren\'t possible!'); |
|
380 | + if ($this->_intpl) { |
|
381 | + $this->Error('Setting links in templates aren\'t possible!'); |
|
382 | + } |
|
366 | 383 | parent::SetLink($link, $y, $page); |
367 | 384 | } |
368 | 385 | |
@@ -402,8 +419,9 @@ discard block |
||
402 | 419 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
403 | 420 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
404 | 421 | $this->_out('/Font <<'); |
405 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
406 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
422 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
423 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
424 | + } |
|
407 | 425 | $this->_out('>>'); |
408 | 426 | } |
409 | 427 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -411,12 +429,14 @@ discard block |
||
411 | 429 | { |
412 | 430 | $this->_out('/XObject <<'); |
413 | 431 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
414 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
415 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
432 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
433 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
434 | + } |
|
416 | 435 | } |
417 | 436 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
418 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
419 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
437 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
438 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
439 | + } |
|
420 | 440 | } |
421 | 441 | $this->_out('>>'); |
422 | 442 | } |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | function setSourceFile($filename) { |
85 | 85 | $this->current_filename = $filename; |
86 | 86 | |
87 | - if (!isset($this->parsers[$filename])) |
|
88 | - $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
87 | + if (!isset($this->parsers[$filename])) { |
|
88 | + $this->parsers[$filename] = $this->_getPdfParser($filename); |
|
89 | + } |
|
89 | 90 | $this->current_parser =& $this->parsers[$filename]; |
90 | 91 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
91 | 92 | |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | $filename = uniqid('tcpdi-'); |
103 | 104 | $this->current_filename = $filename; |
104 | 105 | |
105 | - if (!isset($this->parsers[$filename])) |
|
106 | - $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
106 | + if (!isset($this->parsers[$filename])) { |
|
107 | + $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); |
|
108 | + } |
|
107 | 109 | $this->current_parser =& $this->parsers[$filename]; |
108 | 110 | $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); |
109 | 111 | |
@@ -154,14 +156,16 @@ discard block |
||
154 | 156 | |
155 | 157 | // check if page already imported |
156 | 158 | $pageKey = $fn . '-' . ((int)$pageno) . $boxName; |
157 | - if (isset($this->_importedPages[$pageKey])) |
|
158 | - return $this->_importedPages[$pageKey]; |
|
159 | + if (isset($this->_importedPages[$pageKey])) { |
|
160 | + return $this->_importedPages[$pageKey]; |
|
161 | + } |
|
159 | 162 | |
160 | 163 | $parser =& $this->parsers[$fn]; |
161 | 164 | $parser->setPageno($pageno); |
162 | 165 | |
163 | - if (!in_array($boxName, $parser->availableBoxes)) |
|
164 | - return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
166 | + if (!in_array($boxName, $parser->availableBoxes)) { |
|
167 | + return $this->Error(sprintf('Unknown box: %s', $boxName)); |
|
168 | + } |
|
165 | 169 | |
166 | 170 | $pageboxes = $parser->getPageBoxes($pageno, $this->k); |
167 | 171 | |
@@ -172,13 +176,16 @@ discard block |
||
172 | 176 | * TrimBox: Default -> CropBox |
173 | 177 | * ArtBox: Default -> CropBox |
174 | 178 | */ |
175 | - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) |
|
176 | - $boxName = '/CropBox'; |
|
177 | - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') |
|
178 | - $boxName = '/MediaBox'; |
|
179 | + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) { |
|
180 | + $boxName = '/CropBox'; |
|
181 | + } |
|
182 | + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') { |
|
183 | + $boxName = '/MediaBox'; |
|
184 | + } |
|
179 | 185 | |
180 | - if (!isset($pageboxes[$boxName])) |
|
181 | - return false; |
|
186 | + if (!isset($pageboxes[$boxName])) { |
|
187 | + return false; |
|
188 | + } |
|
182 | 189 | |
183 | 190 | $this->lastUsedPageBox = $boxName; |
184 | 191 | |
@@ -210,8 +217,9 @@ discard block |
||
210 | 217 | $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; |
211 | 218 | $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; |
212 | 219 | |
213 | - if ($angle < 0) |
|
214 | - $angle += 360; |
|
220 | + if ($angle < 0) { |
|
221 | + $angle += 360; |
|
222 | + } |
|
215 | 223 | |
216 | 224 | $tpl['_rotationAngle'] = $angle * -1; |
217 | 225 | } |
@@ -356,8 +364,9 @@ discard block |
||
356 | 364 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
357 | 365 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
358 | 366 | $this->_out('/Font <<'); |
359 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
360 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
367 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
368 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
369 | + } |
|
361 | 370 | $this->_out('>>'); |
362 | 371 | } |
363 | 372 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -365,12 +374,14 @@ discard block |
||
365 | 374 | { |
366 | 375 | $this->_out('/XObject <<'); |
367 | 376 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
368 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
369 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
377 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
378 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
379 | + } |
|
370 | 380 | } |
371 | 381 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
372 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
373 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
382 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
383 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
384 | + } |
|
374 | 385 | } |
375 | 386 | $this->_out('>>'); |
376 | 387 | } |
@@ -648,8 +659,9 @@ discard block |
||
648 | 659 | $out .= chr(0x0A); |
649 | 660 | break; |
650 | 661 | case "\r": |
651 | - if ($count != $n-1 && $s[$count+1] == "\n") |
|
652 | - $count++; |
|
662 | + if ($count != $n-1 && $s[$count+1] == "\n") { |
|
663 | + $count++; |
|
664 | + } |
|
653 | 665 | break; |
654 | 666 | case "\n": |
655 | 667 | break; |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
3 | 3 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
4 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
4 | + if (! defined('USEEXTERNALSERVER')) { |
|
5 | + define('USEEXTERNALSERVER', 1); |
|
6 | + } |
|
5 | 7 | require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php'; |
6 | 8 | } |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
3 | 3 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
4 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
4 | + if (! defined('USEEXTERNALSERVER')) { |
|
5 | + define('USEEXTERNALSERVER', 1); |
|
6 | + } |
|
5 | 7 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; |
6 | 8 | } |
7 | 9 | ?> |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | // File generated to link to the master file - DO NOT MODIFY - It is just an include |
3 | 3 | if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { |
4 | - if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1); |
|
4 | + if (! defined('USEEXTERNALSERVER')) { |
|
5 | + define('USEEXTERNALSERVER', 1); |
|
6 | + } |
|
5 | 7 | require_once '/home/ldestailleur/git/dolibarr_dev/htdocs/master.inc.php'; |
6 | 8 | } |
7 | 9 | ?> |
@@ -6508,15 +6508,13 @@ discard block |
||
6508 | 6508 | $xml .= $this->serializeType ($eName, |
6509 | 6509 | isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], |
6510 | 6510 | $v, $use, $encodingStyle, $unqualified); |
6511 | - } |
|
6512 | - elseif (isset($attrs['type']) || isset($attrs['ref'])) |
|
6511 | + } elseif (isset($attrs['type']) || isset($attrs['ref'])) |
|
6513 | 6512 | { |
6514 | 6513 | // serialize schema-defined type |
6515 | 6514 | $xml .= $this->serializeType ($eName, |
6516 | 6515 | isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], |
6517 | 6516 | $v, $use, $encodingStyle, $unqualified); |
6518 | - } |
|
6519 | - else |
|
6517 | + } else |
|
6520 | 6518 | { |
6521 | 6519 | // serialize generic type (can this ever really happen?) |
6522 | 6520 | $this->debug ("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
@@ -7018,8 +7016,7 @@ discard block |
||
7018 | 7016 | if (isset($this->namespaces[$value_prefix])) |
7019 | 7017 | { |
7020 | 7018 | $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; |
7021 | - } |
|
7022 | - elseif (isset($attrs['xmlns:' . $value_prefix])) |
|
7019 | + } elseif (isset($attrs['xmlns:' . $value_prefix])) |
|
7023 | 7020 | { |
7024 | 7021 | $this->message[$pos]['type_namespace'] = $attrs['xmlns:' . $value_prefix]; |
7025 | 7022 | } |
@@ -52,9 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function addPath($path) |
54 | 54 | { |
55 | - if (false === $path = stream_resolve_include_path($path)) |
|
56 | - return false; |
|
57 | - else set_include_path($path.PATH_SEPARATOR.get_include_path()); |
|
55 | + if (false === $path = stream_resolve_include_path($path)) { |
|
56 | + return false; |
|
57 | + } else { |
|
58 | + set_include_path($path.PATH_SEPARATOR.get_include_path()); |
|
59 | + } |
|
58 | 60 | return $path; |
59 | 61 | } |
60 | 62 | |
@@ -67,16 +69,19 @@ discard block |
||
67 | 69 | */ |
68 | 70 | public static function thereCanBeOnlyOne() |
69 | 71 | { |
70 | - if (static::$perfectLoaders === spl_autoload_functions()) |
|
71 | - return static::$instance; |
|
72 | + if (static::$perfectLoaders === spl_autoload_functions()) { |
|
73 | + return static::$instance; |
|
74 | + } |
|
72 | 75 | |
73 | - if (false !== $loaders = spl_autoload_functions()) |
|
74 | - if (0 < $count = count($loaders)) |
|
76 | + if (false !== $loaders = spl_autoload_functions()) { |
|
77 | + if (0 < $count = count($loaders)) |
|
75 | 78 | for ($i = 0, static::$rogueLoaders += $loaders; |
79 | + } |
|
76 | 80 | $i < $count && false != ($loader = $loaders[$i]); |
77 | - $i++) |
|
78 | - if ($loader !== static::$perfectLoaders[0]) |
|
81 | + $i++) { |
|
82 | + if ($loader !== static::$perfectLoaders[0]) |
|
79 | 83 | spl_autoload_unregister($loader); |
84 | + } |
|
80 | 85 | |
81 | 86 | return static::$instance; |
82 | 87 | } |
@@ -105,12 +110,14 @@ discard block |
||
105 | 110 | return false; |
106 | 111 | } |
107 | 112 | |
108 | - if (empty(static::$classMap[$key])) |
|
109 | - static::$classMap[$key] = $value; |
|
113 | + if (empty(static::$classMap[$key])) { |
|
114 | + static::$classMap[$key] = $value; |
|
115 | + } |
|
110 | 116 | |
111 | - if (is_string($alias = static::$classMap[$key])) |
|
112 | - if (isset(static::$classMap[$alias])) |
|
117 | + if (is_string($alias = static::$classMap[$key])) { |
|
118 | + if (isset(static::$classMap[$alias])) |
|
113 | 119 | return static::$classMap[$alias]; |
120 | + } |
|
114 | 121 | |
115 | 122 | return static::$classMap[$key]; |
116 | 123 | } |
@@ -138,8 +145,8 @@ discard block |
||
138 | 145 | array($dir, 'vendor', 'composer'), |
139 | 146 | array($dir, '..', '..', '..', 'php'), |
140 | 147 | array($dir, 'vendor', 'php')) |
141 | - as $includePath) |
|
142 | - if (false !== $path = stream_resolve_include_path( |
|
148 | + as $includePath) { |
|
149 | + if (false !== $path = stream_resolve_include_path( |
|
143 | 150 | implode($slash, $includePath) |
144 | 151 | )) |
145 | 152 | if ('composer' == end($includePath) && |
@@ -150,18 +157,22 @@ discard block |
||
150 | 157 | static::seen(static::loadFile( |
151 | 158 | $classmapPath |
152 | 159 | )); |
160 | + } |
|
153 | 161 | $paths = array_merge( |
154 | 162 | $paths, |
155 | 163 | array_values(static::loadFile( |
156 | 164 | "$path{$slash}autoload_namespaces.php" |
157 | 165 | )) |
158 | 166 | ); |
159 | - } else $paths[] = $path; |
|
167 | + } else { |
|
168 | + $paths[] = $path; |
|
169 | + } |
|
160 | 170 | |
161 | 171 | $paths = array_filter(array_map( |
162 | 172 | function ($path) { |
163 | - if (false == $realPath = @realpath($path)) |
|
164 | - return null; |
|
173 | + if (false == $realPath = @realpath($path)) { |
|
174 | + return null; |
|
175 | + } |
|
165 | 176 | return $realPath . DIRECTORY_SEPARATOR; |
166 | 177 | }, |
167 | 178 | $paths |
@@ -200,9 +211,11 @@ discard block |
||
200 | 211 | private function loadPrefixes($className) |
201 | 212 | { |
202 | 213 | $currentClass = $className; |
203 | - if (false !== $pos = strrpos($className, '\\')) |
|
204 | - $className = substr($className, $pos); |
|
205 | - else $className = "\\$className"; |
|
214 | + if (false !== $pos = strrpos($className, '\\')) { |
|
215 | + $className = substr($className, $pos); |
|
216 | + } else { |
|
217 | + $className = "\\$className"; |
|
218 | + } |
|
206 | 219 | |
207 | 220 | for ( |
208 | 221 | $i = 0, |
@@ -231,12 +244,13 @@ discard block |
||
231 | 244 | private function loadAliases($className) |
232 | 245 | { |
233 | 246 | $file = false; |
234 | - if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) |
|
235 | - for ( |
|
247 | + if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) { |
|
248 | + for ( |
|
236 | 249 | $i = 0, |
237 | 250 | $aliases = isset(static::$aliases[$parts[1]]) |
238 | 251 | ? static::$aliases[$parts[1]] : array(), |
239 | 252 | $count = count($aliases); |
253 | + } |
|
240 | 254 | $i < $count && false === $file; |
241 | 255 | $file = $this->discover( |
242 | 256 | "{$aliases[$i++]}$parts[2]", |
@@ -263,13 +277,15 @@ discard block |
||
263 | 277 | { |
264 | 278 | $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); |
265 | 279 | if (isset($loader)) { |
266 | - if (false === array_search($loader, $loaders)) |
|
267 | - static::$rogueLoaders[] = $loader; |
|
280 | + if (false === array_search($loader, $loaders)) { |
|
281 | + static::$rogueLoaders[] = $loader; |
|
282 | + } |
|
268 | 283 | return $this->loadThisLoader($className, $loader); |
269 | 284 | } |
270 | - foreach ($loaders as $loader) |
|
271 | - if (false !== $file = $this->loadThisLoader($className, $loader)) |
|
285 | + foreach ($loaders as $loader) { |
|
286 | + if (false !== $file = $this->loadThisLoader($className, $loader)) |
|
272 | 287 | return $file; |
288 | + } |
|
273 | 289 | |
274 | 290 | return false; |
275 | 291 | } |
@@ -313,13 +329,18 @@ discard block |
||
313 | 329 | */ |
314 | 330 | private function alias($className, $currentClass) |
315 | 331 | { |
316 | - if ($className == 'Luracast\Restler\string') return; |
|
317 | - if ($className == 'Luracast\Restler\mixed') return; |
|
332 | + if ($className == 'Luracast\Restler\string') { |
|
333 | + return; |
|
334 | + } |
|
335 | + if ($className == 'Luracast\Restler\mixed') { |
|
336 | + return; |
|
337 | + } |
|
318 | 338 | if ($className != $currentClass |
319 | - && false !== strpos($className, $currentClass)) |
|
320 | - if (!class_exists($currentClass, false) |
|
339 | + && false !== strpos($className, $currentClass)) { |
|
340 | + if (!class_exists($currentClass, false) |
|
321 | 341 | && class_alias($className, $currentClass)) |
322 | 342 | static::seen($currentClass, $className); |
343 | + } |
|
323 | 344 | } |
324 | 345 | |
325 | 346 | /** |
@@ -337,11 +358,12 @@ discard block |
||
337 | 358 | |
338 | 359 | /** The short version we've done this before and found it in cache */ |
339 | 360 | if (false !== $file = static::seen($className)) { |
340 | - if (!$this->exists($className)) |
|
341 | - if (is_callable($file)) |
|
361 | + if (!$this->exists($className)) { |
|
362 | + if (is_callable($file)) |
|
342 | 363 | $file = $this->loadLastResort($className, $file); |
343 | - elseif ($file = stream_resolve_include_path($file)) |
|
344 | - $file = static::loadFile($file); |
|
364 | + } elseif ($file = stream_resolve_include_path($file)) { |
|
365 | + $file = static::loadFile($file); |
|
366 | + } |
|
345 | 367 | |
346 | 368 | $this->alias($className, $currentClass); |
347 | 369 | return $file; |
@@ -351,15 +373,17 @@ discard block |
||
351 | 373 | |
352 | 374 | /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */ |
353 | 375 | $file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); |
354 | - if (false === $file = stream_resolve_include_path("$file.php")) |
|
355 | - return false; |
|
376 | + if (false === $file = stream_resolve_include_path("$file.php")) { |
|
377 | + return false; |
|
378 | + } |
|
356 | 379 | |
357 | 380 | /** have we loaded this file before could this be an alias */ |
358 | 381 | if (in_array($file, get_included_files())) { |
359 | - if (false !== $sameFile = array_search($file, static::$classMap)) |
|
360 | - if (!$this->exists($className, $file)) |
|
382 | + if (false !== $sameFile = array_search($file, static::$classMap)) { |
|
383 | + if (!$this->exists($className, $file)) |
|
361 | 384 | if (false !== strpos($sameFile, $className)) |
362 | 385 | $this->alias($sameFile, $className); |
386 | + } |
|
363 | 387 | |
364 | 388 | return $file; |
365 | 389 | } |
@@ -367,17 +391,19 @@ discard block |
||
367 | 391 | $state = array_merge(get_declared_classes(), get_declared_interfaces()); |
368 | 392 | |
369 | 393 | if (false !== $result = static::loadFile($file)) { |
370 | - if ($this->exists($className, $file)) |
|
371 | - $this->alias($className, $currentClass); |
|
372 | - elseif (false != $diff = array_diff( |
|
373 | - array_merge(get_declared_classes(), get_declared_interfaces()), $state)) |
|
374 | - foreach ($diff as $autoLoaded) |
|
394 | + if ($this->exists($className, $file)) { |
|
395 | + $this->alias($className, $currentClass); |
|
396 | + } elseif (false != $diff = array_diff( |
|
397 | + array_merge(get_declared_classes(), get_declared_interfaces()), $state)) { |
|
398 | + foreach ($diff as $autoLoaded) |
|
375 | 399 | if ($this->exists($autoLoaded, $file)) |
376 | 400 | if (false !== strpos($autoLoaded, $className)) |
377 | 401 | $this->alias($autoLoaded, $className); |
402 | + } |
|
378 | 403 | |
379 | - if (!$this->exists($currentClass)) |
|
380 | - $result = false; |
|
404 | + if (!$this->exists($currentClass)) { |
|
405 | + $result = false; |
|
406 | + } |
|
381 | 407 | } |
382 | 408 | |
383 | 409 | return $result; |
@@ -395,10 +421,12 @@ discard block |
||
395 | 421 | private function exists($className, $mapping = null) |
396 | 422 | { |
397 | 423 | if (class_exists($className, false) |
398 | - || interface_exists($className, false)) |
|
399 | - if (isset($mapping)) |
|
424 | + || interface_exists($className, false)) { |
|
425 | + if (isset($mapping)) |
|
400 | 426 | return static::seen($className, $mapping); |
401 | - else return true; |
|
427 | + } else { |
|
428 | + return true; |
|
429 | + } |
|
402 | 430 | return false; |
403 | 431 | } |
404 | 432 | |
@@ -411,22 +439,27 @@ discard block |
||
411 | 439 | */ |
412 | 440 | public function __invoke($className) |
413 | 441 | { |
414 | - if (empty($className)) |
|
415 | - return false; |
|
442 | + if (empty($className)) { |
|
443 | + return false; |
|
444 | + } |
|
416 | 445 | |
417 | - if (false !== $includeReference = $this->discover($className)) |
|
418 | - return $includeReference; |
|
446 | + if (false !== $includeReference = $this->discover($className)) { |
|
447 | + return $includeReference; |
|
448 | + } |
|
419 | 449 | |
420 | 450 | static::thereCanBeOnlyOne(); |
421 | 451 | |
422 | - if (false !== $includeReference = $this->loadAliases($className)) |
|
423 | - return $includeReference; |
|
452 | + if (false !== $includeReference = $this->loadAliases($className)) { |
|
453 | + return $includeReference; |
|
454 | + } |
|
424 | 455 | |
425 | - if (false !== $includeReference = $this->loadPrefixes($className)) |
|
426 | - return $includeReference; |
|
456 | + if (false !== $includeReference = $this->loadPrefixes($className)) { |
|
457 | + return $includeReference; |
|
458 | + } |
|
427 | 459 | |
428 | - if (false !== $includeReference = $this->loadLastResort($className)) |
|
429 | - return $includeReference; |
|
460 | + if (false !== $includeReference = $this->loadLastResort($className)) { |
|
461 | + return $includeReference; |
|
462 | + } |
|
430 | 463 | |
431 | 464 | static::seen($className, true); |
432 | 465 | return null; |
@@ -327,10 +327,16 @@ |
||
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | - if (empty($idorcode)) $idorcode = 'all'; |
|
330 | + if (empty($idorcode)) { |
|
331 | + $idorcode = 'all'; |
|
332 | + } |
|
331 | 333 | $TType = $TSystem[$idorcode]; |
332 | - if (! empty($TSystemAuto[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
333 | - if (! empty($TModule[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
334 | + if (! empty($TSystemAuto[$idorcode])) { |
|
335 | + $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
336 | + } |
|
337 | + if (! empty($TModule[$idorcode])) { |
|
338 | + $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
339 | + } |
|
334 | 340 | $this->liste_array = $TType; |
335 | 341 | |
336 | 342 |