@@ -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 | ?> |
@@ -78,7 +78,10 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | $md5uniqid = md5(uniqid()); |
81 | - if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or / |
|
81 | + if ($this->config['PATH_TO_TMP']) { |
|
82 | + $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); |
|
83 | + } |
|
84 | + // Remove last \ or / |
|
82 | 85 | $this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid; |
83 | 86 | $this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug. |
84 | 87 | |
@@ -94,7 +97,9 @@ discard block |
||
94 | 97 | |
95 | 98 | // Load zip proxy |
96 | 99 | $zipHandler = $this->config['ZIP_PROXY']; |
97 | - if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
|
100 | + if (!defined('PCLZIP_TEMPORARY_DIR')) { |
|
101 | + define('PCLZIP_TEMPORARY_DIR', $this->tmpdir); |
|
102 | + } |
|
98 | 103 | include_once 'zip/'.$zipHandler.'.php'; |
99 | 104 | if (! class_exists($this->config['ZIP_PROXY'])) { |
100 | 105 | throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings'); |
@@ -236,8 +241,12 @@ discard block |
||
236 | 241 | */ |
237 | 242 | private function _replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations, $encode = false, $charset = '') |
238 | 243 | { |
239 | - if ($customStyles == null) $customStyles = array(); |
|
240 | - if ($fontDeclarations == null) $fontDeclarations = array(); |
|
244 | + if ($customStyles == null) { |
|
245 | + $customStyles = array(); |
|
246 | + } |
|
247 | + if ($fontDeclarations == null) { |
|
248 | + $fontDeclarations = array(); |
|
249 | + } |
|
241 | 250 | |
242 | 251 | $odtResult = ''; |
243 | 252 | |
@@ -595,7 +604,9 @@ discard block |
||
595 | 604 | $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
596 | 605 | preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER); |
597 | 606 | 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 |
598 | - if (!empty($match[3])) $this->contentXml = str_replace($match[0], $match[3], $this->contentXml); |
|
607 | + if (!empty($match[3])) { |
|
608 | + $this->contentXml = str_replace($match[0], $match[3], $this->contentXml); |
|
609 | + } |
|
599 | 610 | } |
600 | 611 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
601 | 612 | $this->contentXml = preg_replace($reg, '', $this->contentXml); |
@@ -608,9 +619,15 @@ discard block |
||
608 | 619 | } |
609 | 620 | |
610 | 621 | // Static substitution |
611 | - if ($type == 'content') $this->contentXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->contentXml); |
|
612 | - if ($type == 'styles') $this->stylesXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->stylesXml); |
|
613 | - if ($type == 'meta') $this->metaXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->metaXml); |
|
622 | + if ($type == 'content') { |
|
623 | + $this->contentXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->contentXml); |
|
624 | + } |
|
625 | + if ($type == 'styles') { |
|
626 | + $this->stylesXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->stylesXml); |
|
627 | + } |
|
628 | + if ($type == 'meta') { |
|
629 | + $this->metaXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->metaXml); |
|
630 | + } |
|
614 | 631 | } |
615 | 632 | |
616 | 633 | /** |
@@ -751,7 +768,9 @@ discard block |
||
751 | 768 | */ |
752 | 769 | public function setMetaData() |
753 | 770 | { |
754 | - if (empty($this->creator)) $this->creator=''; |
|
771 | + if (empty($this->creator)) { |
|
772 | + $this->creator=''; |
|
773 | + } |
|
755 | 774 | |
756 | 775 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
757 | 776 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -819,7 +838,9 @@ discard block |
||
819 | 838 | { |
820 | 839 | global $conf; |
821 | 840 | |
822 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
841 | + if ( $name == "" ) { |
|
842 | + $name = "temp".md5(uniqid()); |
|
843 | + } |
|
823 | 844 | |
824 | 845 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
825 | 846 | $this->saveToDisk($name); |
@@ -43,9 +43,15 @@ |
||
43 | 43 | */ |
44 | 44 | |
45 | 45 | $nbmodulesnotautoenabled = count($conf->modules); |
46 | -if (in_array('fckeditor', $conf->modules)) $nbmodulesnotautoenabled--; |
|
47 | -if (in_array('export', $conf->modules)) $nbmodulesnotautoenabled--; |
|
48 | -if (in_array('import', $conf->modules)) $nbmodulesnotautoenabled--; |
|
46 | +if (in_array('fckeditor', $conf->modules)) { |
|
47 | + $nbmodulesnotautoenabled--; |
|
48 | +} |
|
49 | +if (in_array('export', $conf->modules)) { |
|
50 | + $nbmodulesnotautoenabled--; |
|
51 | +} |
|
52 | +if (in_array('import', $conf->modules)) { |
|
53 | + $nbmodulesnotautoenabled--; |
|
54 | +} |
|
49 | 55 | |
50 | 56 | // Check if company name is defined (first install) |
51 | 57 | if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || !getDolGlobalString('MAIN_INFO_SOCIETE_NOM')) { |
@@ -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 | } |