@@ -222,7 +222,9 @@ discard block |
||
222 | 222 | $output = '<'.$this->nss.'line>'; |
223 | 223 | foreach ($geom->getComponents() as $k => $point) { |
224 | 224 | $output .= $point->getY().' '.$point->getX(); |
225 | - if ($k < ($geom->numGeometries() -1)) $output .= ' '; |
|
225 | + if ($k < ($geom->numGeometries() -1)) { |
|
226 | + $output .= ' '; |
|
227 | + } |
|
226 | 228 | } |
227 | 229 | $output .= '</'.$this->nss.'line>'; |
228 | 230 | return $output; |
@@ -234,7 +236,9 @@ discard block |
||
234 | 236 | $exterior_ring = $geom->exteriorRing(); |
235 | 237 | foreach ($exterior_ring->getComponents() as $k => $point) { |
236 | 238 | $output .= $point->getY().' '.$point->getX(); |
237 | - if ($k < ($exterior_ring->numGeometries() -1)) $output .= ' '; |
|
239 | + if ($k < ($exterior_ring->numGeometries() -1)) { |
|
240 | + $output .= ' '; |
|
241 | + } |
|
238 | 242 | } |
239 | 243 | $output .= '</'.$this->nss.'polygon>'; |
240 | 244 | return $output; |
@@ -153,9 +153,11 @@ |
||
153 | 153 | 'type'=> 'GeometryCollection', |
154 | 154 | 'geometries'=> $component_array, |
155 | 155 | ); |
156 | - } else return array( |
|
156 | + } else { |
|
157 | + return array( |
|
157 | 158 | 'type'=> $geometry->getGeomType(), |
158 | 159 | 'coordinates'=> $geometry->asArray(), |
159 | 160 | ); |
161 | + } |
|
160 | 162 | } |
161 | 163 | } |
@@ -98,7 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function write(Geometry $geometry, $precision = null) |
100 | 100 | { |
101 | - if ($geometry->isEmpty()) return ''; |
|
101 | + if ($geometry->isEmpty()) { |
|
102 | + return ''; |
|
103 | + } |
|
102 | 104 | |
103 | 105 | if ($geometry->geometryType() === 'Point') { |
104 | 106 | return $this->encodePoint($geometry, $precision); |
@@ -197,19 +199,59 @@ discard block |
||
197 | 199 | for ($i=0,$c=strlen($hash);$i<$c;$i++) { |
198 | 200 | $v = strpos($this->table, $hash[$i]); |
199 | 201 | if (1&$i) { |
200 | - if (16&$v)$minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
201 | - if (8&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
202 | - if (4&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
203 | - if (2&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
204 | - if (1&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
202 | + if (16&$v) { |
|
203 | + $minlat = ($minlat+$maxlat)/2; |
|
204 | + } else { |
|
205 | + $maxlat = ($minlat+$maxlat)/2; |
|
206 | + } |
|
207 | + if (8&$v) { |
|
208 | + $minlon = ($minlon+$maxlon)/2; |
|
209 | + } else { |
|
210 | + $maxlon = ($minlon+$maxlon)/2; |
|
211 | + } |
|
212 | + if (4&$v) { |
|
213 | + $minlat = ($minlat+$maxlat)/2; |
|
214 | + } else { |
|
215 | + $maxlat = ($minlat+$maxlat)/2; |
|
216 | + } |
|
217 | + if (2&$v) { |
|
218 | + $minlon = ($minlon+$maxlon)/2; |
|
219 | + } else { |
|
220 | + $maxlon = ($minlon+$maxlon)/2; |
|
221 | + } |
|
222 | + if (1&$v) { |
|
223 | + $minlat = ($minlat+$maxlat)/2; |
|
224 | + } else { |
|
225 | + $maxlat = ($minlat+$maxlat)/2; |
|
226 | + } |
|
205 | 227 | $latE /= 8; |
206 | 228 | $lonE /= 4; |
207 | 229 | } else { |
208 | - if (16&$v)$minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
209 | - if (8&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
210 | - if (4&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
211 | - if (2&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
212 | - if (1&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
230 | + if (16&$v) { |
|
231 | + $minlon = ($minlon+$maxlon)/2; |
|
232 | + } else { |
|
233 | + $maxlon = ($minlon+$maxlon)/2; |
|
234 | + } |
|
235 | + if (8&$v) { |
|
236 | + $minlat = ($minlat+$maxlat)/2; |
|
237 | + } else { |
|
238 | + $maxlat = ($minlat+$maxlat)/2; |
|
239 | + } |
|
240 | + if (4&$v) { |
|
241 | + $minlon = ($minlon+$maxlon)/2; |
|
242 | + } else { |
|
243 | + $maxlon = ($minlon+$maxlon)/2; |
|
244 | + } |
|
245 | + if (2&$v) { |
|
246 | + $minlat = ($minlat+$maxlat)/2; |
|
247 | + } else { |
|
248 | + $maxlat = ($minlat+$maxlat)/2; |
|
249 | + } |
|
250 | + if (1&$v) { |
|
251 | + $minlon = ($minlon+$maxlon)/2; |
|
252 | + } else { |
|
253 | + $maxlon = ($minlon+$maxlon)/2; |
|
254 | + } |
|
213 | 255 | $latE /= 4; |
214 | 256 | $lonE /= 8; |
215 | 257 | } |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | if (!$type) { |
55 | 55 | // If the user is trying to load a Geometry from a Geometry... Just pass it back |
56 | 56 | if (is_object($data)) { |
57 | - if ($data instanceOf Geometry) return $data; |
|
57 | + if ($data instanceOf Geometry) { |
|
58 | + return $data; |
|
59 | + } |
|
58 | 60 | } |
59 | 61 | |
60 | 62 | $detected = geoPHP::detectFormat($data); |
@@ -124,7 +126,9 @@ discard block |
||
124 | 126 | static function geosInstalled($force = null) |
125 | 127 | { |
126 | 128 | static $geos_installed = null; |
127 | - if ($force !== null) $geos_installed = $force; |
|
129 | + if ($force !== null) { |
|
130 | + $geos_installed = $force; |
|
131 | + } |
|
128 | 132 | if ($geos_installed !== null) { |
129 | 133 | return $geos_installed; |
130 | 134 | } |
@@ -154,8 +158,12 @@ discard block |
||
154 | 158 | { |
155 | 159 | // If it's an array of one, then just parse the one |
156 | 160 | if (is_array($geometry)) { |
157 | - if (empty($geometry)) return false; |
|
158 | - if (count($geometry) == 1) return geoPHP::geometryReduce(array_shift($geometry)); |
|
161 | + if (empty($geometry)) { |
|
162 | + return false; |
|
163 | + } |
|
164 | + if (count($geometry) == 1) { |
|
165 | + return geoPHP::geometryReduce(array_shift($geometry)); |
|
166 | + } |
|
159 | 167 | } |
160 | 168 | |
161 | 169 | // If the geometry cannot even theoretically be reduced more, then pass it back |
@@ -233,7 +241,9 @@ discard block |
||
233 | 241 | $bytes = unpack("c*", fread($mem, 11)); |
234 | 242 | |
235 | 243 | // If bytes is empty, then we were passed empty input |
236 | - if (empty($bytes)) return false; |
|
244 | + if (empty($bytes)) { |
|
245 | + return false; |
|
246 | + } |
|
237 | 247 | |
238 | 248 | // First char is a tab, space or carriage-return. trim it and try again |
239 | 249 | if ($bytes[1] == 9 || $bytes[1] == 10 || $bytes[1] == 32) { |
@@ -244,8 +254,11 @@ discard block |
||
244 | 254 | // Detect WKB or EWKB -- first byte is 1 (little endian indicator) |
245 | 255 | if ($bytes[1] == 1) { |
246 | 256 | // If SRID byte is TRUE (1), it's EWKB |
247 | - if ($bytes[5]) return 'ewkb'; |
|
248 | - else return 'wkb'; |
|
257 | + if ($bytes[5]) { |
|
258 | + return 'ewkb'; |
|
259 | + } else { |
|
260 | + return 'wkb'; |
|
261 | + } |
|
249 | 262 | } |
250 | 263 | |
251 | 264 | // Detect HEX encoded WKB or EWKB (PostGIS format) -- first byte is 48, second byte is 49 (hex '01' => first-byte = 1) |
@@ -278,12 +291,24 @@ discard block |
||
278 | 291 | if ($bytes[1] == 60) { |
279 | 292 | // grab the first 256 characters |
280 | 293 | $string = substr($input, 0, 256); |
281 | - if (strpos($string, '<kml') !== false) return 'kml'; |
|
282 | - if (strpos($string, '<coordinate') !== false) return 'kml'; |
|
283 | - if (strpos($string, '<gpx') !== false) return 'gpx'; |
|
284 | - if (strpos($string, '<georss') !== false) return 'georss'; |
|
285 | - if (strpos($string, '<rss') !== false) return 'georss'; |
|
286 | - if (strpos($string, '<feed') !== false) return 'georss'; |
|
294 | + if (strpos($string, '<kml') !== false) { |
|
295 | + return 'kml'; |
|
296 | + } |
|
297 | + if (strpos($string, '<coordinate') !== false) { |
|
298 | + return 'kml'; |
|
299 | + } |
|
300 | + if (strpos($string, '<gpx') !== false) { |
|
301 | + return 'gpx'; |
|
302 | + } |
|
303 | + if (strpos($string, '<georss') !== false) { |
|
304 | + return 'georss'; |
|
305 | + } |
|
306 | + if (strpos($string, '<rss') !== false) { |
|
307 | + return 'georss'; |
|
308 | + } |
|
309 | + if (strpos($string, '<feed') !== false) { |
|
310 | + return 'georss'; |
|
311 | + } |
|
287 | 312 | } |
288 | 313 | |
289 | 314 | // We need an 8 byte string for geohash and unpacked WKB / WKT |
@@ -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 | } |
@@ -342,13 +358,18 @@ discard block |
||
342 | 358 | */ |
343 | 359 | private function alias($className, $currentClass) |
344 | 360 | { |
345 | - if ($className == 'Luracast\Restler\string') return; |
|
346 | - if ($className == 'Luracast\Restler\mixed') return; |
|
361 | + if ($className == 'Luracast\Restler\string') { |
|
362 | + return; |
|
363 | + } |
|
364 | + if ($className == 'Luracast\Restler\mixed') { |
|
365 | + return; |
|
366 | + } |
|
347 | 367 | if ($className != $currentClass |
348 | - && false !== strpos($className, $currentClass)) |
|
349 | - if (!class_exists($currentClass, false) |
|
368 | + && false !== strpos($className, $currentClass)) { |
|
369 | + if (!class_exists($currentClass, false) |
|
350 | 370 | && class_alias($className, $currentClass)) |
351 | 371 | static::seen($currentClass, $className); |
372 | + } |
|
352 | 373 | } |
353 | 374 | |
354 | 375 | /** |
@@ -366,11 +387,12 @@ discard block |
||
366 | 387 | |
367 | 388 | /** The short version we've done this before and found it in cache */ |
368 | 389 | if (false !== $file = static::seen($className)) { |
369 | - if (!$this->exists($className)) |
|
370 | - if (is_callable($file)) |
|
390 | + if (!$this->exists($className)) { |
|
391 | + if (is_callable($file)) |
|
371 | 392 | $file = $this->loadLastResort($className, $file); |
372 | - elseif ($file = stream_resolve_include_path($file)) |
|
373 | - $file = static::loadFile($file); |
|
393 | + } elseif ($file = stream_resolve_include_path($file)) { |
|
394 | + $file = static::loadFile($file); |
|
395 | + } |
|
374 | 396 | |
375 | 397 | $this->alias($className, $currentClass); |
376 | 398 | return $file; |
@@ -380,15 +402,17 @@ discard block |
||
380 | 402 | |
381 | 403 | /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */ |
382 | 404 | $file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); |
383 | - if (false === $file = stream_resolve_include_path("$file.php")) |
|
384 | - return false; |
|
405 | + if (false === $file = stream_resolve_include_path("$file.php")) { |
|
406 | + return false; |
|
407 | + } |
|
385 | 408 | |
386 | 409 | /** have we loaded this file before could this be an alias */ |
387 | 410 | if (in_array($file, get_included_files())) { |
388 | - if (false !== $sameFile = array_search($file, static::$classMap)) |
|
389 | - if (!$this->exists($className, $file)) |
|
411 | + if (false !== $sameFile = array_search($file, static::$classMap)) { |
|
412 | + if (!$this->exists($className, $file)) |
|
390 | 413 | if (false !== strpos($sameFile, $className)) |
391 | 414 | $this->alias($sameFile, $className); |
415 | + } |
|
392 | 416 | |
393 | 417 | return $file; |
394 | 418 | } |
@@ -396,17 +420,19 @@ discard block |
||
396 | 420 | $state = array_merge(get_declared_classes(), get_declared_interfaces()); |
397 | 421 | |
398 | 422 | if (false !== $result = static::loadFile($file)) { |
399 | - if ($this->exists($className, $file)) |
|
400 | - $this->alias($className, $currentClass); |
|
401 | - elseif (false != $diff = array_diff( |
|
402 | - array_merge(get_declared_classes(), get_declared_interfaces()), $state)) |
|
403 | - foreach ($diff as $autoLoaded) |
|
423 | + if ($this->exists($className, $file)) { |
|
424 | + $this->alias($className, $currentClass); |
|
425 | + } elseif (false != $diff = array_diff( |
|
426 | + array_merge(get_declared_classes(), get_declared_interfaces()), $state)) { |
|
427 | + foreach ($diff as $autoLoaded) |
|
404 | 428 | if ($this->exists($autoLoaded, $file)) |
405 | 429 | if (false !== strpos($autoLoaded, $className)) |
406 | 430 | $this->alias($autoLoaded, $className); |
431 | + } |
|
407 | 432 | |
408 | - if (!$this->exists($currentClass)) |
|
409 | - $result = false; |
|
433 | + if (!$this->exists($currentClass)) { |
|
434 | + $result = false; |
|
435 | + } |
|
410 | 436 | } |
411 | 437 | |
412 | 438 | return $result; |
@@ -424,10 +450,12 @@ discard block |
||
424 | 450 | private function exists($className, $mapping = null) |
425 | 451 | { |
426 | 452 | if (class_exists($className, false) |
427 | - || interface_exists($className, false)) |
|
428 | - if (isset($mapping)) |
|
453 | + || interface_exists($className, false)) { |
|
454 | + if (isset($mapping)) |
|
429 | 455 | return static::seen($className, $mapping); |
430 | - else return true; |
|
456 | + } else { |
|
457 | + return true; |
|
458 | + } |
|
431 | 459 | return false; |
432 | 460 | } |
433 | 461 | |
@@ -440,23 +468,28 @@ discard block |
||
440 | 468 | */ |
441 | 469 | public function __invoke($className) |
442 | 470 | { |
443 | - if (empty($className)) |
|
444 | - return false; |
|
471 | + if (empty($className)) { |
|
472 | + return false; |
|
473 | + } |
|
445 | 474 | |
446 | - if (false !== $includeReference = $this->discover($className)) |
|
447 | - return $includeReference; |
|
475 | + if (false !== $includeReference = $this->discover($className)) { |
|
476 | + return $includeReference; |
|
477 | + } |
|
448 | 478 | |
449 | 479 | // @CHANGE LDR Reduce cases of conflicts with the messy autoload |
450 | 480 | //static::thereCanBeOnlyOne(); |
451 | 481 | |
452 | - if (false !== $includeReference = $this->loadAliases($className)) |
|
453 | - return $includeReference; |
|
482 | + if (false !== $includeReference = $this->loadAliases($className)) { |
|
483 | + return $includeReference; |
|
484 | + } |
|
454 | 485 | |
455 | - if (false !== $includeReference = $this->loadPrefixes($className)) |
|
456 | - return $includeReference; |
|
486 | + if (false !== $includeReference = $this->loadPrefixes($className)) { |
|
487 | + return $includeReference; |
|
488 | + } |
|
457 | 489 | |
458 | - if (false !== $includeReference = $this->loadLastResort($className)) |
|
459 | - return $includeReference; |
|
490 | + if (false !== $includeReference = $this->loadLastResort($className)) { |
|
491 | + return $includeReference; |
|
492 | + } |
|
460 | 493 | |
461 | 494 | static::seen($className, true); |
462 | 495 | return null; |
@@ -585,19 +585,23 @@ |
||
585 | 585 | $duration = $obj->duree; |
586 | 586 | $event['location'] = ($obj->socname ? $obj->socname : ""); |
587 | 587 | $event['summary'] = $obj->ref." - ". $obj->description; |
588 | - if ($obj->ref_client) |
|
589 | - $event['summary'].= " (".$obj->ref_client.")"; |
|
588 | + if ($obj->ref_client) { |
|
589 | + $event['summary'].= " (".$obj->ref_client.")"; |
|
590 | + } |
|
590 | 591 | |
591 | 592 | $event['desc'] = $obj->description; |
592 | 593 | |
593 | - if ($obj->ref_project) |
|
594 | - $event['desc'] .= " - ".$obj->ref_project; |
|
594 | + if ($obj->ref_project) { |
|
595 | + $event['desc'] .= " - ".$obj->ref_project; |
|
596 | + } |
|
595 | 597 | |
596 | - if ($obj->ref_contract) |
|
597 | - $event['desc'] .= " - ".$obj->ref_contract; |
|
598 | + if ($obj->ref_contract) { |
|
599 | + $event['desc'] .= " - ".$obj->ref_contract; |
|
600 | + } |
|
598 | 601 | |
599 | - if ($obj->note_public) |
|
600 | - $event['desc'].= " - ".$obj->note_public; |
|
602 | + if ($obj->note_public) { |
|
603 | + $event['desc'].= " - ".$obj->note_public; |
|
604 | + } |
|
601 | 605 | |
602 | 606 | $event['startdate'] = $datestart; |
603 | 607 | $event['enddate'] = ''; // $dateend; // Not required with type 'journal' |
@@ -213,8 +213,7 @@ discard block |
||
213 | 213 | $CurrentBlock = $Block; |
214 | 214 | |
215 | 215 | continue; |
216 | - } |
|
217 | - else |
|
216 | + } else |
|
218 | 217 | { |
219 | 218 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
220 | 219 | { |
@@ -282,8 +281,7 @@ discard block |
||
282 | 281 | if (isset($Block)) |
283 | 282 | { |
284 | 283 | $CurrentBlock = $Block; |
285 | - } |
|
286 | - else |
|
284 | + } else |
|
287 | 285 | { |
288 | 286 | if (isset($CurrentBlock)) |
289 | 287 | { |
@@ -323,8 +321,7 @@ discard block |
||
323 | 321 | if (isset($Component['markup'])) |
324 | 322 | { |
325 | 323 | $Component['element'] = array('rawHtml' => $Component['markup']); |
326 | - } |
|
327 | - elseif (isset($Component['hidden'])) |
|
324 | + } elseif (isset($Component['hidden'])) |
|
328 | 325 | { |
329 | 326 | $Component['element'] = array(); |
330 | 327 | } |
@@ -584,8 +581,7 @@ discard block |
||
584 | 581 | $contentIndent -= 1; |
585 | 582 | $matches[1] = substr($matches[1], 0, -$contentIndent); |
586 | 583 | $matches[3] = str_repeat(' ', $contentIndent) . $matches[3]; |
587 | - } |
|
588 | - elseif ($contentIndent === 0) |
|
584 | + } elseif ($contentIndent === 0) |
|
589 | 585 | { |
590 | 586 | $matches[1] .= ' '; |
591 | 587 | } |
@@ -687,8 +683,7 @@ discard block |
||
687 | 683 | $Block['element']['elements'] []= & $Block['li']; |
688 | 684 | |
689 | 685 | return $Block; |
690 | - } |
|
691 | - elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line)) |
|
686 | + } elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line)) |
|
692 | 687 | { |
693 | 688 | return null; |
694 | 689 | } |
@@ -1316,12 +1311,10 @@ discard block |
||
1316 | 1311 | if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) |
1317 | 1312 | { |
1318 | 1313 | $emphasis = 'strong'; |
1319 | - } |
|
1320 | - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
1314 | + } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
1321 | 1315 | { |
1322 | 1316 | $emphasis = 'em'; |
1323 | - } |
|
1324 | - else |
|
1317 | + } else |
|
1325 | 1318 | { |
1326 | 1319 | return; |
1327 | 1320 | } |
@@ -1412,8 +1405,7 @@ discard block |
||
1412 | 1405 | $extent += strlen($matches[0]); |
1413 | 1406 | |
1414 | 1407 | $remainder = substr($remainder, $extent); |
1415 | - } |
|
1416 | - else |
|
1408 | + } else |
|
1417 | 1409 | { |
1418 | 1410 | return; |
1419 | 1411 | } |
@@ -1428,8 +1420,7 @@ discard block |
||
1428 | 1420 | } |
1429 | 1421 | |
1430 | 1422 | $extent += strlen($matches[0]); |
1431 | - } |
|
1432 | - else |
|
1423 | + } else |
|
1433 | 1424 | { |
1434 | 1425 | if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) |
1435 | 1426 | { |
@@ -1437,8 +1428,7 @@ discard block |
||
1437 | 1428 | $definition = strtolower($definition); |
1438 | 1429 | |
1439 | 1430 | $extent += strlen($matches[0]); |
1440 | - } |
|
1441 | - else |
|
1431 | + } else |
|
1442 | 1432 | { |
1443 | 1433 | $definition = strtolower($Element['handler']['argument']); |
1444 | 1434 | } |
@@ -1603,8 +1593,7 @@ discard block |
||
1603 | 1593 | $argument = $Element['text']; |
1604 | 1594 | unset($Element['text']); |
1605 | 1595 | $destination = 'rawHtml'; |
1606 | - } |
|
1607 | - else |
|
1596 | + } else |
|
1608 | 1597 | { |
1609 | 1598 | $function = $Element['handler']['function']; |
1610 | 1599 | $argument = $Element['handler']['argument']; |
@@ -1641,8 +1630,7 @@ discard block |
||
1641 | 1630 | if (isset($Element['elements'])) |
1642 | 1631 | { |
1643 | 1632 | $Element['elements'] = $this->elementsApplyRecursive($closure, $Element['elements']); |
1644 | - } |
|
1645 | - elseif (isset($Element['element'])) |
|
1633 | + } elseif (isset($Element['element'])) |
|
1646 | 1634 | { |
1647 | 1635 | $Element['element'] = $this->elementApplyRecursive($closure, $Element['element']); |
1648 | 1636 | } |
@@ -1655,8 +1643,7 @@ discard block |
||
1655 | 1643 | if (isset($Element['elements'])) |
1656 | 1644 | { |
1657 | 1645 | $Element['elements'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['elements']); |
1658 | - } |
|
1659 | - elseif (isset($Element['element'])) |
|
1646 | + } elseif (isset($Element['element'])) |
|
1660 | 1647 | { |
1661 | 1648 | $Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']); |
1662 | 1649 | } |
@@ -1743,26 +1730,22 @@ discard block |
||
1743 | 1730 | if (isset($Element['elements'])) |
1744 | 1731 | { |
1745 | 1732 | $markup .= $this->elements($Element['elements']); |
1746 | - } |
|
1747 | - elseif (isset($Element['element'])) |
|
1733 | + } elseif (isset($Element['element'])) |
|
1748 | 1734 | { |
1749 | 1735 | $markup .= $this->element($Element['element']); |
1750 | - } |
|
1751 | - else |
|
1736 | + } else |
|
1752 | 1737 | { |
1753 | 1738 | if (!$permitRawHtml) |
1754 | 1739 | { |
1755 | 1740 | $markup .= self::escape($text, true); |
1756 | - } |
|
1757 | - else |
|
1741 | + } else |
|
1758 | 1742 | { |
1759 | 1743 | $markup .= $text; |
1760 | 1744 | } |
1761 | 1745 | } |
1762 | 1746 | |
1763 | 1747 | $markup .= $hasName ? '</' . $Element['name'] . '>' : ''; |
1764 | - } |
|
1765 | - elseif ($hasName) |
|
1748 | + } elseif ($hasName) |
|
1766 | 1749 | { |
1767 | 1750 | $markup .= ' />'; |
1768 | 1751 | } |
@@ -1928,8 +1911,7 @@ discard block |
||
1928 | 1911 | if ($len > strlen($string)) |
1929 | 1912 | { |
1930 | 1913 | return false; |
1931 | - } |
|
1932 | - else |
|
1914 | + } else |
|
1933 | 1915 | { |
1934 | 1916 | return strtolower(substr($string, 0, $len)) === strtolower($needle); |
1935 | 1917 | } |
@@ -88,10 +88,16 @@ discard block |
||
88 | 88 | { |
89 | 89 | // To provide debug information on line number processed |
90 | 90 | global $count; |
91 | - if (empty($count)) $count=1; |
|
92 | - else $count++; |
|
91 | + if (empty($count)) { |
|
92 | + $count=1; |
|
93 | + } else { |
|
94 | + $count++; |
|
95 | + } |
|
93 | 96 | |
94 | - if (empty($this->savxml)) $this->savxml = $this->xml; // Sav content of line at first line merged, so we will reuse original for next steps |
|
97 | + if (empty($this->savxml)) { |
|
98 | + $this->savxml = $this->xml; |
|
99 | + } |
|
100 | + // Sav content of line at first line merged, so we will reuse original for next steps |
|
95 | 101 | $this->xml = $this->savxml; |
96 | 102 | $tmpvars = $this->vars; // Store into $tmpvars so we won't modify this->vars when completing data with empty values |
97 | 103 | |
@@ -123,7 +129,9 @@ discard block |
||
123 | 129 | $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy |
124 | 130 | preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); |
125 | 131 | foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause |
126 | - if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
132 | + if (!empty($match[3])) { |
|
133 | + $this->xml = str_replace($match[0], $match[3], $this->xml); |
|
134 | + } |
|
127 | 135 | } |
128 | 136 | // Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether) |
129 | 137 | $this->xml = preg_replace($reg, '', $this->xml); |
@@ -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' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($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); |