@@ -39,7 +39,7 @@ |
||
39 | 39 | * @param Doku_Event $event the DokuWiki event |
40 | 40 | */ |
41 | 41 | public function insertButton(Doku_Event $event, $param) { |
42 | - $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" '; |
|
42 | + $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" '; |
|
43 | 43 | $strOpen .= 'lon="5.1" zoom="12" statusbar="1" controls="1" poihoverstyle="0" '; |
44 | 44 | $strOpen .= 'baselyr="OpenStreetMap" gpxfile="" kmlfile="" geojsonfile="" summary="" >\n'; |
45 | 45 | $strOpen .= '~~ Plugin olmap help.\n'; |
@@ -42,8 +42,8 @@ |
||
42 | 42 | </head> |
43 | 43 | <body> |
44 | 44 | <div class="box"><?php |
45 | - foreach(glob('*.png') as $img) { |
|
46 | - echo '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" /> '; |
|
45 | + foreach (glob('*.png') as $img) { |
|
46 | + echo '<img src="'.$img.'" alt="'.$img.'" title="'.$img.'" /> '; |
|
47 | 47 | } |
48 | 48 | ?></div> |
49 | 49 | </body> |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * Simple test to make sure the plugin.info.txt is in correct format. |
31 | 31 | */ |
32 | 32 | final public function test_plugininfo(): void { |
33 | - $file = __DIR__ . '/../plugin.info.txt'; |
|
33 | + $file = __DIR__.'/../plugin.info.txt'; |
|
34 | 34 | self::assertFileExists($file); |
35 | 35 | |
36 | 36 | $info = confToHash($file); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function getMenuIcon(): string { |
36 | 36 | $plugin = $this->getPluginName(); |
37 | - return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
37 | + return DOKU_PLUGIN.$plugin.'/admin/purge.svg'; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function handle(): void { |
45 | 45 | global $conf; |
46 | - if(!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
46 | + if (!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | - if(isset($_REQUEST['purgetiles'])) { |
|
50 | - $path = $conf['cachedir'] . '/olmaptiles'; |
|
51 | - if($this->rrmdir($path)) { |
|
49 | + if (isset($_REQUEST['purgetiles'])) { |
|
50 | + $path = $conf['cachedir'].'/olmaptiles'; |
|
51 | + if ($this->rrmdir($path)) { |
|
52 | 52 | msg($this->getLang('admin_purged_tiles'), 0); |
53 | 53 | } |
54 | 54 | } |
55 | - if(isset($_REQUEST['purgemaps'])) { |
|
56 | - $path = $conf['mediadir'] . '/olmapmaps'; |
|
57 | - if($this->rrmdir($path)) { |
|
55 | + if (isset($_REQUEST['purgemaps'])) { |
|
56 | + $path = $conf['mediadir'].'/olmapmaps'; |
|
57 | + if ($this->rrmdir($path)) { |
|
58 | 58 | msg($this->getLang('admin_purged_maps'), 0); |
59 | 59 | } |
60 | 60 | } |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return boolean true when succesful |
67 | 67 | */ |
68 | 68 | private function rrmdir(string $sDir): bool { |
69 | - if(is_dir($sDir)) { |
|
69 | + if (is_dir($sDir)) { |
|
70 | 70 | dbglog($sDir, 'admin_plugin_openlayersmap_purge::rrmdir: recursively removing path: '); |
71 | 71 | $sDir = rtrim($sDir, '/'); |
72 | 72 | $oDir = dir($sDir); |
73 | - while(($sFile = $oDir->read()) !== false) { |
|
74 | - if($sFile !== '.' && $sFile !== '..') { |
|
73 | + while (($sFile = $oDir->read()) !== false) { |
|
74 | + if ($sFile !== '.' && $sFile !== '..') { |
|
75 | 75 | (!is_link("$sDir/$sFile") && is_dir("$sDir/$sFile")) ? |
76 | 76 | $this->rrmdir("$sDir/$sFile") : unlink("$sDir/$sFile"); |
77 | 77 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />' |
99 | 99 | ); |
100 | 100 | $form->addElement( |
101 | - '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles') |
|
101 | + '<label for="purgetiles" class="label">'.$this->getLang('admin_purge_tiles') |
|
102 | 102 | . '</label>' |
103 | 103 | ); |
104 | 104 | $form->addElement('</p>'); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $form->addElement('<p>'); |
109 | 109 | $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />'); |
110 | 110 | $form->addElement( |
111 | - '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>' |
|
111 | + '<label for="purgemaps" class="label">'.$this->getLang('admin_purge_maps').'</label>' |
|
112 | 112 | ); |
113 | 113 | $form->addElement('</p>'); |
114 | 114 | $form->endFieldset(); |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | |
91 | 91 | // normalize zoom |
92 | 92 | $zoom = $zoom ?: 0; |
93 | - if($zoom > 18) { |
|
93 | + if ($zoom > 18) { |
|
94 | 94 | $zoom = 18; |
95 | 95 | } |
96 | 96 | // normalize WxH |
97 | 97 | list($width, $height) = explode('x', $size); |
98 | 98 | $width = (int) $width; |
99 | - if($width > $this->maxWidth) { |
|
99 | + if ($width > $this->maxWidth) { |
|
100 | 100 | $width = $this->maxWidth; |
101 | 101 | } |
102 | 102 | $height = (int) $height; |
103 | - if($height > $this->maxHeight) { |
|
103 | + if ($height > $this->maxHeight) { |
|
104 | 104 | $height = $this->maxHeight; |
105 | 105 | } |
106 | 106 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $geojson = $this->mediaIdToPath($geojson); |
113 | 113 | |
114 | 114 | // create map |
115 | - require_once DOKU_PLUGIN . 'openlayersmap/StaticMap.php'; |
|
115 | + require_once DOKU_PLUGIN.'openlayersmap/StaticMap.php'; |
|
116 | 116 | $map = new StaticMap( |
117 | 117 | $lat, $lon, $zoom, $width, $height, $maptype, |
118 | 118 | $markers, $gpx, $kml, $geojson, $conf['mediadir'], $conf['cachedir'], |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private function mediaIdToPath(string $id): string { |
137 | 137 | global $conf; |
138 | - if(empty($id)) { |
|
138 | + if (empty($id)) { |
|
139 | 139 | return ""; |
140 | 140 | } |
141 | 141 | $id = str_replace(array("[[", "]]"), "", $id); |
142 | - if((strpos($id, ':') === 0)) { |
|
142 | + if ((strpos($id, ':') === 0)) { |
|
143 | 143 | $id = substr($id, 1); |
144 | 144 | } |
145 | 145 | $id = str_replace(":", "/", $id); |
146 | - return $conf['mediadir'] . '/' . $id; |
|
146 | + return $conf['mediadir'].'/'.$id; |
|
147 | 147 | } |
148 | 148 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | // phpcs:disable PSR1.Files.SideEffects |
23 | 23 | // TODO resolve side effect |
24 | -include_once(realpath(__DIR__) . '/../geophp/geoPHP/geoPHP.inc'); |
|
24 | +include_once(realpath(__DIR__).'/../geophp/geoPHP/geoPHP.inc'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $this->height = $height; |
206 | 206 | // validate + set maptype |
207 | 207 | $this->maptype = $this->tileDefaultSrc; |
208 | - if(array_key_exists($maptype, $this->tileInfo)) { |
|
208 | + if (array_key_exists($maptype, $this->tileInfo)) { |
|
209 | 209 | $this->maptype = $maptype; |
210 | 210 | } |
211 | 211 | $this->markers = $markers; |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | $this->gpxFileName = $gpx; |
214 | 214 | $this->geojsonFileName = $geojson; |
215 | 215 | $this->mediaBaseDir = $mediaDir; |
216 | - $this->tileCacheBaseDir = $tileCacheBaseDir . '/olmaptiles'; |
|
216 | + $this->tileCacheBaseDir = $tileCacheBaseDir.'/olmaptiles'; |
|
217 | 217 | $this->useTileCache = $this->tileCacheBaseDir !== ''; |
218 | - $this->mapCacheBaseDir = $mediaDir . '/olmapmaps'; |
|
218 | + $this->mapCacheBaseDir = $mediaDir.'/olmapmaps'; |
|
219 | 219 | $this->autoZoomExtent = $autoZoomExtent; |
220 | 220 | $this->apikey = $apikey; |
221 | 221 | } |
@@ -227,15 +227,15 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function getMap(): string { |
229 | 229 | try { |
230 | - if($this->autoZoomExtent) { |
|
230 | + if ($this->autoZoomExtent) { |
|
231 | 231 | $this->autoZoom(); |
232 | 232 | } |
233 | - } catch(Exception $e) { |
|
233 | + } catch (Exception $e) { |
|
234 | 234 | dbglog($e); |
235 | 235 | } |
236 | 236 | |
237 | 237 | // use map cache, so check cache for map |
238 | - if(!$this->checkMapCache()) { |
|
238 | + if (!$this->checkMapCache()) { |
|
239 | 239 | // map is not in cache, needs to be build |
240 | 240 | $this->makeMap(); |
241 | 241 | $this->mkdirRecursive(dirname($this->mapCacheIDToFilename()), 0777); |
@@ -258,37 +258,37 @@ discard block |
||
258 | 258 | */ |
259 | 259 | private function autoZoom(float $paddingFactor = 1.0): void { |
260 | 260 | $geoms = array(); |
261 | - $geoms [] = new Point ($this->lon, $this->lat); |
|
262 | - if(!empty ($this->markers)) { |
|
263 | - foreach($this->markers as $marker) { |
|
264 | - $geoms [] = new Point ($marker ['lon'], $marker ['lat']); |
|
261 | + $geoms [] = new Point($this->lon, $this->lat); |
|
262 | + if (!empty ($this->markers)) { |
|
263 | + foreach ($this->markers as $marker) { |
|
264 | + $geoms [] = new Point($marker ['lon'], $marker ['lat']); |
|
265 | 265 | } |
266 | 266 | } |
267 | - if(file_exists($this->kmlFileName)) { |
|
267 | + if (file_exists($this->kmlFileName)) { |
|
268 | 268 | $g = geoPHP::load(file_get_contents($this->kmlFileName), 'kml'); |
269 | - if($g !== false) { |
|
269 | + if ($g !== false) { |
|
270 | 270 | $geoms [] = $g; |
271 | 271 | } |
272 | 272 | } |
273 | - if(file_exists($this->gpxFileName)) { |
|
273 | + if (file_exists($this->gpxFileName)) { |
|
274 | 274 | $g = geoPHP::load(file_get_contents($this->gpxFileName), 'gpx'); |
275 | - if($g !== false) { |
|
275 | + if ($g !== false) { |
|
276 | 276 | $geoms [] = $g; |
277 | 277 | } |
278 | 278 | } |
279 | - if(file_exists($this->geojsonFileName)) { |
|
279 | + if (file_exists($this->geojsonFileName)) { |
|
280 | 280 | $g = geoPHP::load(file_get_contents($this->geojsonFileName), 'geojson'); |
281 | - if($g !== false) { |
|
281 | + if ($g !== false) { |
|
282 | 282 | $geoms [] = $g; |
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
286 | - if(count($geoms) <= 1) { |
|
286 | + if (count($geoms) <= 1) { |
|
287 | 287 | dbglog($geoms, "StaticMap::autoZoom: Skip setting autozoom options"); |
288 | 288 | return; |
289 | 289 | } |
290 | 290 | |
291 | - $geom = new GeometryCollection ($geoms); |
|
291 | + $geom = new GeometryCollection($geoms); |
|
292 | 292 | $centroid = $geom->centroid(); |
293 | 293 | $bbox = $geom->getBBox(); |
294 | 294 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $resolution = max($resolutionHorizontal, $resolutionVertical) * $paddingFactor; |
305 | 305 | $zoom = log(360 / ($resolution * $this->tileSize), 2); |
306 | 306 | |
307 | - if(is_finite($zoom) && $zoom < 15 && $zoom > 2) { |
|
307 | + if (is_finite($zoom) && $zoom < 15 && $zoom > 2) { |
|
308 | 308 | $this->zoom = floor($zoom); |
309 | 309 | } |
310 | 310 | $this->lon = $centroid->getX(); |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | public function mapCacheIDToFilename(): string { |
340 | - if(!$this->mapCacheFile) { |
|
341 | - $this->mapCacheFile = $this->mapCacheBaseDir . "/" . $this->maptype . "/" . $this->zoom . "/cache_" |
|
342 | - . substr($this->mapCacheID, 0, 2) . "/" . substr($this->mapCacheID, 2, 2) |
|
343 | - . "/" . substr($this->mapCacheID, 4); |
|
340 | + if (!$this->mapCacheFile) { |
|
341 | + $this->mapCacheFile = $this->mapCacheBaseDir."/".$this->maptype."/".$this->zoom."/cache_" |
|
342 | + . substr($this->mapCacheID, 0, 2)."/".substr($this->mapCacheID, 2, 2) |
|
343 | + . "/".substr($this->mapCacheID, 4); |
|
344 | 344 | } |
345 | - return $this->mapCacheFile . "." . $this->mapCacheExtension; |
|
345 | + return $this->mapCacheFile.".".$this->mapCacheExtension; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | public function makeMap(): void { |
352 | 352 | $this->initCoords(); |
353 | 353 | $this->createBaseMap(); |
354 | - if(!empty ($this->markers)) |
|
354 | + if (!empty ($this->markers)) |
|
355 | 355 | $this->placeMarkers(); |
356 | - if(file_exists($this->kmlFileName)) |
|
356 | + if (file_exists($this->kmlFileName)) |
|
357 | 357 | $this->drawKML(); |
358 | - if(file_exists($this->gpxFileName)) |
|
358 | + if (file_exists($this->gpxFileName)) |
|
359 | 359 | $this->drawGPX(); |
360 | - if(file_exists($this->geojsonFileName)) |
|
360 | + if (file_exists($this->geojsonFileName)) |
|
361 | 361 | $this->drawGeojson(); |
362 | 362 | |
363 | 363 | $this->drawCopyright(); |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | $this->offsetX += floor($startX - floor($this->centerX)) * $this->tileSize; |
409 | 409 | $this->offsetY += floor($startY - floor($this->centerY)) * $this->tileSize; |
410 | 410 | |
411 | - for($x = $startX; $x <= $endX; $x++) { |
|
412 | - for($y = $startY; $y <= $endY; $y++) { |
|
411 | + for ($x = $startX; $x <= $endX; $x++) { |
|
412 | + for ($y = $startY; $y <= $endY; $y++) { |
|
413 | 413 | $url = str_replace( |
414 | 414 | array( |
415 | 415 | '{Z}', |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | ); |
424 | 424 | |
425 | 425 | $tileData = $this->fetchTile($url); |
426 | - if($tileData) { |
|
426 | + if ($tileData) { |
|
427 | 427 | $tileImage = imagecreatefromstring($tileData); |
428 | 428 | } else { |
429 | 429 | $tileImage = imagecreate($this->tileSize, $this->tileSize); |
@@ -449,17 +449,17 @@ discard block |
||
449 | 449 | * for better proxy handling... |
450 | 450 | */ |
451 | 451 | public function fetchTile(string $url) { |
452 | - if($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
452 | + if ($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
453 | 453 | return $cached; |
454 | 454 | |
455 | - $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')'; |
|
456 | - if(function_exists("curl_init")) { |
|
455 | + $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; '.PHP_OS.')'; |
|
456 | + if (function_exists("curl_init")) { |
|
457 | 457 | // use cUrl |
458 | 458 | $ch = curl_init(); |
459 | 459 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
460 | 460 | curl_setopt($ch, CURLOPT_USERAGENT, $_UA); |
461 | 461 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); |
462 | - curl_setopt($ch, CURLOPT_URL, $url . $this->apikey); |
|
462 | + curl_setopt($ch, CURLOPT_URL, $url.$this->apikey); |
|
463 | 463 | dbglog("StaticMap::fetchTile: getting: $url using curl_exec"); |
464 | 464 | $tile = curl_exec($ch); |
465 | 465 | curl_close($ch); |
@@ -469,21 +469,21 @@ discard block |
||
469 | 469 | $opts = array( |
470 | 470 | 'http' => array( |
471 | 471 | 'method' => "GET", |
472 | - 'header' => "Accept-language: en\r\n" . "User-Agent: $_UA\r\n" . "accept: image/png\r\n", |
|
472 | + 'header' => "Accept-language: en\r\n"."User-Agent: $_UA\r\n"."accept: image/png\r\n", |
|
473 | 473 | 'request_fulluri' => true |
474 | 474 | ) |
475 | 475 | ); |
476 | - if(isset($conf['proxy']['host'], $conf['proxy']['port']) |
|
476 | + if (isset($conf['proxy']['host'], $conf['proxy']['port']) |
|
477 | 477 | && $conf['proxy']['host'] !== '' |
478 | 478 | && $conf['proxy']['port'] !== '') { |
479 | - $opts['http'] += ['proxy' => "tcp://" . $conf['proxy']['host'] . ":" . $conf['proxy']['port']]; |
|
479 | + $opts['http'] += ['proxy' => "tcp://".$conf['proxy']['host'].":".$conf['proxy']['port']]; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | $context = stream_context_create($opts); |
483 | 483 | dbglog("StaticMap::fetchTile: getting: $url . $this->apikey using file_get_contents and options $opts"); |
484 | - $tile = file_get_contents($url . $this->apikey, false, $context); |
|
484 | + $tile = file_get_contents($url.$this->apikey, false, $context); |
|
485 | 485 | } |
486 | - if($tile && $this->useTileCache) { |
|
486 | + if ($tile && $this->useTileCache) { |
|
487 | 487 | $this->writeTileToCache($url, $tile); |
488 | 488 | } |
489 | 489 | return $tile; |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | */ |
497 | 497 | public function checkTileCache(string $url) { |
498 | 498 | $filename = $this->tileUrlToFilename($url); |
499 | - if(file_exists($filename)) { |
|
499 | + if (file_exists($filename)) { |
|
500 | 500 | return file_get_contents($filename); |
501 | 501 | } |
502 | 502 | return false; |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @return string |
509 | 509 | */ |
510 | 510 | public function tileUrlToFilename(string $url): string { |
511 | - return $this->tileCacheBaseDir . "/" . substr($url, strpos($url, '/') + 1); |
|
511 | + return $this->tileCacheBaseDir."/".substr($url, strpos($url, '/') + 1); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | /** |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | $count = 0; |
544 | 544 | $color = imagecolorallocate($this->image, 0, 0, 0); |
545 | 545 | $bgcolor = imagecolorallocate($this->image, 200, 200, 200); |
546 | - $markerBaseDir = __DIR__ . '/icons'; |
|
546 | + $markerBaseDir = __DIR__.'/icons'; |
|
547 | 547 | // loop thru marker array |
548 | - foreach($this->markers as $marker) { |
|
548 | + foreach ($this->markers as $marker) { |
|
549 | 549 | // set some local variables |
550 | 550 | $markerLat = $marker ['lat']; |
551 | 551 | $markerLon = $marker ['lon']; |
@@ -555,18 +555,18 @@ discard block |
||
555 | 555 | $markerShadow = ''; |
556 | 556 | $matches = false; |
557 | 557 | // check for marker type, get settings from markerPrototypes |
558 | - if($markerType) { |
|
559 | - foreach($this->markerPrototypes as $markerPrototype) { |
|
560 | - if(preg_match($markerPrototype ['regex'], $markerType, $matches)) { |
|
561 | - $markerFilename = $matches [0] . $markerPrototype ['extension']; |
|
562 | - if($markerPrototype ['offsetImage']) { |
|
558 | + if ($markerType) { |
|
559 | + foreach ($this->markerPrototypes as $markerPrototype) { |
|
560 | + if (preg_match($markerPrototype ['regex'], $markerType, $matches)) { |
|
561 | + $markerFilename = $matches [0].$markerPrototype ['extension']; |
|
562 | + if ($markerPrototype ['offsetImage']) { |
|
563 | 563 | list ($markerImageOffsetX, $markerImageOffsetY) = explode( |
564 | 564 | ",", |
565 | 565 | $markerPrototype ['offsetImage'] |
566 | 566 | ); |
567 | 567 | } |
568 | 568 | $markerShadow = $markerPrototype ['shadow']; |
569 | - if($markerShadow) { |
|
569 | + if ($markerShadow) { |
|
570 | 570 | list ($markerShadowOffsetX, $markerShadowOffsetY) = explode( |
571 | 571 | ",", |
572 | 572 | $markerPrototype ['offsetShadow'] |
@@ -576,14 +576,14 @@ discard block |
||
576 | 576 | } |
577 | 577 | } |
578 | 578 | // create img resource |
579 | - if(file_exists($markerBaseDir . '/' . $markerFilename)) { |
|
580 | - $markerImg = imagecreatefrompng($markerBaseDir . '/' . $markerFilename); |
|
579 | + if (file_exists($markerBaseDir.'/'.$markerFilename)) { |
|
580 | + $markerImg = imagecreatefrompng($markerBaseDir.'/'.$markerFilename); |
|
581 | 581 | } else { |
582 | - $markerImg = imagecreatefrompng($markerBaseDir . '/marker.png'); |
|
582 | + $markerImg = imagecreatefrompng($markerBaseDir.'/marker.png'); |
|
583 | 583 | } |
584 | 584 | // check for shadow + create shadow recource |
585 | - if($markerShadow && file_exists($markerBaseDir . '/' . $markerShadow)) { |
|
586 | - $markerShadowImg = imagecreatefrompng($markerBaseDir . '/' . $markerShadow); |
|
585 | + if ($markerShadow && file_exists($markerBaseDir.'/'.$markerShadow)) { |
|
586 | + $markerShadowImg = imagecreatefrompng($markerBaseDir.'/'.$markerShadow); |
|
587 | 587 | } |
588 | 588 | // calc position |
589 | 589 | $destX = floor( |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | $this->tileSize * ($this->centerY - $this->latToTile($markerLat, $this->zoom)) |
596 | 596 | ); |
597 | 597 | // copy shadow on basemap |
598 | - if($markerShadow && $markerShadowImg) { |
|
598 | + if ($markerShadow && $markerShadowImg) { |
|
599 | 599 | imagecopy( |
600 | 600 | $this->image, |
601 | 601 | $markerShadowImg, |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | * drawing colour |
657 | 657 | */ |
658 | 658 | private function drawGeometry(Geometry $geom, int $colour): void { |
659 | - if(empty($geom)) { |
|
659 | + if (empty($geom)) { |
|
660 | 660 | return; |
661 | 661 | } |
662 | 662 | |
663 | - switch($geom->geometryType()) { |
|
663 | + switch ($geom->geometryType()) { |
|
664 | 664 | case 'GeometryCollection' : |
665 | 665 | // recursively draw part of the collection |
666 | - for($i = 1; $i < $geom->numGeometries() + 1; $i++) { |
|
666 | + for ($i = 1; $i < $geom->numGeometries() + 1; $i++) { |
|
667 | 667 | $_geom = $geom->geometryN($i); |
668 | 668 | $this->drawGeometry($_geom, $colour); |
669 | 669 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | // extring is a linestring actually.. |
706 | 706 | $extRing = $polygon->exteriorRing(); |
707 | 707 | |
708 | - for($i = 1; $i < $extRing->numGeometries(); $i++) { |
|
708 | + for ($i = 1; $i < $extRing->numGeometries(); $i++) { |
|
709 | 709 | $p1 = $extRing->geometryN($i); |
710 | 710 | $x = floor( |
711 | 711 | ($this->width / 2) - $this->tileSize * ($this->centerX - $this->lonToTile($p1->x(), $this->zoom)) |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | */ |
732 | 732 | private function drawLineString($line, $colour) { |
733 | 733 | imagesetthickness($this->image, 2); |
734 | - for($p = 1; $p < $line->numGeometries(); $p++) { |
|
734 | + for ($p = 1; $p < $line->numGeometries(); $p++) { |
|
735 | 735 | // get first pair of points |
736 | 736 | $p1 = $line->geometryN($p); |
737 | 737 | $p2 = $line->geometryN($p + 1); |
@@ -802,8 +802,8 @@ discard block |
||
802 | 802 | * add copyright and origin notice and icons to the map. |
803 | 803 | */ |
804 | 804 | public function drawCopyright() { |
805 | - $logoBaseDir = dirname(__FILE__) . '/' . 'logo/'; |
|
806 | - $logoImg = imagecreatefrompng($logoBaseDir . $this->tileInfo ['openstreetmap'] ['logo']); |
|
805 | + $logoBaseDir = dirname(__FILE__).'/'.'logo/'; |
|
806 | + $logoImg = imagecreatefrompng($logoBaseDir.$this->tileInfo ['openstreetmap'] ['logo']); |
|
807 | 807 | $textcolor = imagecolorallocate($this->image, 0, 0, 0); |
808 | 808 | $bgcolor = imagecolorallocate($this->image, 200, 200, 200); |
809 | 809 | |
@@ -836,11 +836,11 @@ discard block |
||
836 | 836 | |
837 | 837 | // additional tile source info, ie. who created/hosted the tiles |
838 | 838 | $xIconOffset = 0; |
839 | - if($this->maptype === 'openstreetmap') { |
|
839 | + if ($this->maptype === 'openstreetmap') { |
|
840 | 840 | $mapAuthor = "(c) OpenStreetMap maps/CC BY-SA"; |
841 | 841 | } else { |
842 | 842 | $mapAuthor = $this->tileInfo [$this->maptype] ['txt']; |
843 | - $iconImg = imagecreatefrompng($logoBaseDir . $this->tileInfo [$this->maptype] ['logo']); |
|
843 | + $iconImg = imagecreatefrompng($logoBaseDir.$this->tileInfo [$this->maptype] ['logo']); |
|
844 | 844 | $xIconOffset = imagesx($iconImg); |
845 | 845 | imagecopy( |
846 | 846 | $this->image, |
@@ -117,13 +117,13 @@ |
||
117 | 117 | static $overlaynumber = 0; |
118 | 118 | |
119 | 119 | list ($id, $url, $name, $visible) = $data; |
120 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
121 | - $str = '{'; |
|
120 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
121 | + $str = '{'; |
|
122 | 122 | foreach ($data as $key => $val) { |
123 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
123 | + $str .= "'".$key."' : '".$val."',"; |
|
124 | 124 | } |
125 | 125 | $str .= '"type":"osm"}'; |
126 | - $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";") |
|
126 | + $renderer->doc .= base64_encode("olMapOverlays['osm".$overlaynumber."'] = ".$str.";") |
|
127 | 127 | . '"></script>'; |
128 | 128 | $overlaynumber++; |
129 | 129 | return true; |
@@ -121,13 +121,13 @@ |
||
121 | 121 | static $overlaynumber = 0; |
122 | 122 | |
123 | 123 | list ($id, $url, $name, $visible) = $data; |
124 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
125 | - $str = '{'; |
|
124 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
125 | + $str = '{'; |
|
126 | 126 | foreach ($data as $key => $val) { |
127 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
127 | + $str .= "'".$key."' : '".$val."',"; |
|
128 | 128 | } |
129 | 129 | $str .= "'type':'ags'}"; |
130 | - $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";") |
|
130 | + $renderer->doc .= base64_encode("olMapOverlays['ags".$overlaynumber."'] = ".$str.";") |
|
131 | 131 | . '"></script>'; |
132 | 132 | $overlaynumber++; |
133 | 133 | return true; |
@@ -120,13 +120,13 @@ |
||
120 | 120 | static $overlaynumber = 0; |
121 | 121 | |
122 | 122 | list ($id, $url, $name, $visible) = $data; |
123 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
124 | - $str = '{'; |
|
123 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
124 | + $str = '{'; |
|
125 | 125 | foreach ($data as $key => $val) { |
126 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
126 | + $str .= "'".$key."' : '".$val."',"; |
|
127 | 127 | } |
128 | 128 | $str .= "'type':'wms'}"; |
129 | - $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";") |
|
129 | + $renderer->doc .= base64_encode("olMapOverlays['wms".$overlaynumber."'] = ".$str.";") |
|
130 | 130 | . '"></script>'; |
131 | 131 | $overlaynumber++; |
132 | 132 | return true; |