@@ -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 | } |
@@ -444,7 +444,9 @@ |
||
444 | 444 | { |
445 | 445 | $paymentsalary = array(); |
446 | 446 | $fields = Salaries::$FIELDSPAYMENT; |
447 | - if (isModEnabled("bank")) array_push($fields, "accountid"); |
|
447 | + if (isModEnabled("bank")) { |
|
448 | + array_push($fields, "accountid"); |
|
449 | + } |
|
448 | 450 | foreach ($fields as $field) { |
449 | 451 | if (!isset($data[$field])) { |
450 | 452 | throw new RestException(400, "$field field missing"); |
@@ -48,7 +48,9 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | // Not sure this is required |
51 | -if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
51 | +if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) { |
|
52 | + unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
53 | +} |
|
52 | 54 | |
53 | 55 | if (GETPOST('noredirect')) { |
54 | 56 | return; |
@@ -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 | |
@@ -556,10 +565,15 @@ discard block |
||
556 | 565 | */ |
557 | 566 | private function _parse($type = 'content') |
558 | 567 | { |
559 | - if ($type == 'content') $xml = &$this->contentXml; |
|
560 | - elseif ($type == 'styles') $xml = &$this->stylesXml; |
|
561 | - elseif ($type == 'meta') $xml = &$this->metaXml; |
|
562 | - else return; |
|
568 | + if ($type == 'content') { |
|
569 | + $xml = &$this->contentXml; |
|
570 | + } elseif ($type == 'styles') { |
|
571 | + $xml = &$this->stylesXml; |
|
572 | + } elseif ($type == 'meta') { |
|
573 | + $xml = &$this->metaXml; |
|
574 | + } else { |
|
575 | + return; |
|
576 | + } |
|
563 | 577 | |
564 | 578 | // Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined |
565 | 579 | $reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; |
@@ -600,7 +614,9 @@ discard block |
||
600 | 614 | $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
601 | 615 | preg_match_all($reg, $xml, $matches, PREG_SET_ORDER); |
602 | 616 | 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 |
603 | - if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml); |
|
617 | + if (!empty($match[3])) { |
|
618 | + $xml = str_replace($match[0], $match[3], $xml); |
|
619 | + } |
|
604 | 620 | } |
605 | 621 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
606 | 622 | $xml = preg_replace($reg, '', $xml); |
@@ -754,7 +770,9 @@ discard block |
||
754 | 770 | */ |
755 | 771 | public function setMetaData() |
756 | 772 | { |
757 | - if (empty($this->creator)) $this->creator=''; |
|
773 | + if (empty($this->creator)) { |
|
774 | + $this->creator=''; |
|
775 | + } |
|
758 | 776 | |
759 | 777 | $this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml); |
760 | 778 | $this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml); |
@@ -822,7 +840,9 @@ discard block |
||
822 | 840 | { |
823 | 841 | global $conf; |
824 | 842 | |
825 | - if ( $name == "" ) $name = "temp".md5(uniqid()); |
|
843 | + if ( $name == "" ) { |
|
844 | + $name = "temp".md5(uniqid()); |
|
845 | + } |
|
826 | 846 | |
827 | 847 | dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG); |
828 | 848 | $this->saveToDisk($name); |
@@ -60,7 +60,9 @@ |
||
60 | 60 | |
61 | 61 | public function envelope() |
62 | 62 | { |
63 | - if ($this->isEmpty()) return new Polygon(); |
|
63 | + if ($this->isEmpty()) { |
|
64 | + return new Polygon(); |
|
65 | + } |
|
64 | 66 | |
65 | 67 | if ($this->geos()) { |
66 | 68 | return geoPHP::geosToGeometry($this->geos()->envelope()); |
@@ -53,14 +53,17 @@ discard block |
||
53 | 53 | public function invertxy() |
54 | 54 | { |
55 | 55 | for ($i=0;$i<count($this->components);$i++) { |
56 | - if ( method_exists($this->components[$i], 'invertxy') ) |
|
57 | - $this->components[$i]->invertxy(); |
|
56 | + if ( method_exists($this->components[$i], 'invertxy') ) { |
|
57 | + $this->components[$i]->invertxy(); |
|
58 | + } |
|
58 | 59 | } |
59 | 60 | } |
60 | 61 | |
61 | 62 | public function centroid() |
62 | 63 | { |
63 | - if ($this->isEmpty()) return null; |
|
64 | + if ($this->isEmpty()) { |
|
65 | + return null; |
|
66 | + } |
|
64 | 67 | |
65 | 68 | if ($this->geos()) { |
66 | 69 | $geos_centroid = $this->geos()->centroid(); |
@@ -79,7 +82,9 @@ discard block |
||
79 | 82 | |
80 | 83 | public function getBBox() |
81 | 84 | { |
82 | - if ($this->isEmpty()) return null; |
|
85 | + if ($this->isEmpty()) { |
|
86 | + return null; |
|
87 | + } |
|
83 | 88 | |
84 | 89 | if ($this->geos()) { |
85 | 90 | $envelope = $this->geos()->envelope(); |
@@ -150,7 +155,9 @@ discard block |
||
150 | 155 | // By default, the boundary of a collection is the boundary of it's components |
151 | 156 | public function boundary() |
152 | 157 | { |
153 | - if ($this->isEmpty()) return new LineString(); |
|
158 | + if ($this->isEmpty()) { |
|
159 | + return new LineString(); |
|
160 | + } |
|
154 | 161 | |
155 | 162 | if ($this->geos()) { |
156 | 163 | return $this->geos()->boundary(); |
@@ -224,7 +231,9 @@ discard block |
||
224 | 231 | return true; |
225 | 232 | } else { |
226 | 233 | foreach ($this->components as $component) { |
227 | - if (!$component->isEmpty()) return false; |
|
234 | + if (!$component->isEmpty()) { |
|
235 | + return false; |
|
236 | + } |
|
228 | 237 | } |
229 | 238 | return true; |
230 | 239 | } |
@@ -295,7 +304,9 @@ discard block |
||
295 | 304 | |
296 | 305 | // A collection is simple if all it's components are simple |
297 | 306 | foreach ($this->components as $component) { |
298 | - if (!$component->isSimple()) return false; |
|
307 | + if (!$component->isSimple()) { |
|
308 | + return false; |
|
309 | + } |
|
299 | 310 | } |
300 | 311 | |
301 | 312 | return true; |
@@ -83,7 +83,9 @@ |
||
83 | 83 | { |
84 | 84 | if ($this->dimension == 3) { |
85 | 85 | return $this->coords[2]; |
86 | - } else return null; |
|
86 | + } else { |
|
87 | + return null; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | /** |
@@ -62,7 +62,9 @@ |
||
62 | 62 | |
63 | 63 | public function dimension() |
64 | 64 | { |
65 | - if ($this->isEmpty()) return 0; |
|
65 | + if ($this->isEmpty()) { |
|
66 | + return 0; |
|
67 | + } |
|
66 | 68 | return 1; |
67 | 69 | } |
68 | 70 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | public function area($exterior_only = false, $signed = false) |
18 | 18 | { |
19 | - if ($this->isEmpty()) return 0; |
|
19 | + if ($this->isEmpty()) { |
|
20 | + return 0; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | if ($this->geos() && $exterior_only == false) { |
22 | 24 | return $this->geos()->area(); |
@@ -26,15 +28,20 @@ discard block |
||
26 | 28 | $pts = $exterior_ring->getComponents(); |
27 | 29 | |
28 | 30 | $c = count($pts); |
29 | - if ((int) $c == '0') return null; |
|
31 | + if ((int) $c == '0') { |
|
32 | + return null; |
|
33 | + } |
|
30 | 34 | $a = '0'; |
31 | 35 | foreach ($pts as $k => $p) { |
32 | 36 | $j = ($k + 1) % $c; |
33 | 37 | $a = $a + ($p->getX() * $pts[$j]->getY()) - ($p->getY() * $pts[$j]->getX()); |
34 | 38 | } |
35 | 39 | |
36 | - if ($signed) $area = ($a / 2); |
|
37 | - else $area = abs(($a / 2)); |
|
40 | + if ($signed) { |
|
41 | + $area = ($a / 2); |
|
42 | + } else { |
|
43 | + $area = abs(($a / 2)); |
|
44 | + } |
|
38 | 45 | |
39 | 46 | if ($exterior_only == true) { |
40 | 47 | return $area; |
@@ -50,7 +57,9 @@ discard block |
||
50 | 57 | |
51 | 58 | public function centroid() |
52 | 59 | { |
53 | - if ($this->isEmpty()) return null; |
|
60 | + if ($this->isEmpty()) { |
|
61 | + return null; |
|
62 | + } |
|
54 | 63 | |
55 | 64 | if ($this->geos()) { |
56 | 65 | return geoPHP::geosToGeometry($this->geos()->centroid()); |
@@ -60,7 +69,9 @@ discard block |
||
60 | 69 | $pts = $exterior_ring->getComponents(); |
61 | 70 | |
62 | 71 | $c = count($pts); |
63 | - if ((int) $c == '0') return null; |
|
72 | + if ((int) $c == '0') { |
|
73 | + return null; |
|
74 | + } |
|
64 | 75 | $cn = array('x' => '0', 'y' => '0'); |
65 | 76 | $a = $this->area(true, true); |
66 | 77 | |
@@ -108,13 +119,17 @@ discard block |
||
108 | 119 | |
109 | 120 | public function exteriorRing() |
110 | 121 | { |
111 | - if ($this->isEmpty()) return new LineString(); |
|
122 | + if ($this->isEmpty()) { |
|
123 | + return new LineString(); |
|
124 | + } |
|
112 | 125 | return $this->components[0]; |
113 | 126 | } |
114 | 127 | |
115 | 128 | public function numInteriorRings() |
116 | 129 | { |
117 | - if ($this->isEmpty()) return 0; |
|
130 | + if ($this->isEmpty()) { |
|
131 | + return 0; |
|
132 | + } |
|
118 | 133 | return $this->numGeometries()-1; |
119 | 134 | } |
120 | 135 | |
@@ -125,7 +140,9 @@ discard block |
||
125 | 140 | |
126 | 141 | public function dimension() |
127 | 142 | { |
128 | - if ($this->isEmpty()) return 0; |
|
143 | + if ($this->isEmpty()) { |
|
144 | + return 0; |
|
145 | + } |
|
129 | 146 | return 2; |
130 | 147 | } |
131 | 148 |