@@ -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 | } |
@@ -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" controls="1" '; |
| 44 | 44 | $strOpen .= 'baselyr="OpenStreetMap" gpxfile="" kmlfile="" geojsonfile="" summary="" >\n'; |
| 45 | 45 | $strOpen .= '~~ Plugin olmap help.\n'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | // phpcs:disable PSR1.Files.SideEffects |
| 30 | 30 | // TODO resolve side effect |
| 31 | -require_once __DIR__ . '/../geophp/vendor/autoload.php'; |
|
| 31 | +require_once __DIR__.'/../geophp/vendor/autoload.php'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $this->height = $height; |
| 213 | 213 | // validate + set maptype |
| 214 | 214 | $this->maptype = $this->tileDefaultSrc; |
| 215 | - if(array_key_exists($maptype, $this->tileInfo)) { |
|
| 215 | + if (array_key_exists($maptype, $this->tileInfo)) { |
|
| 216 | 216 | $this->maptype = $maptype; |
| 217 | 217 | } |
| 218 | 218 | $this->markers = $markers; |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | $this->gpxFileName = $gpx; |
| 221 | 221 | $this->geojsonFileName = $geojson; |
| 222 | 222 | $this->mediaBaseDir = $mediaDir; |
| 223 | - $this->tileCacheBaseDir = $tileCacheBaseDir . '/olmaptiles'; |
|
| 223 | + $this->tileCacheBaseDir = $tileCacheBaseDir.'/olmaptiles'; |
|
| 224 | 224 | $this->useTileCache = $this->tileCacheBaseDir !== ''; |
| 225 | - $this->mapCacheBaseDir = $mediaDir . '/olmapmaps'; |
|
| 225 | + $this->mapCacheBaseDir = $mediaDir.'/olmapmaps'; |
|
| 226 | 226 | $this->autoZoomExtent = $autoZoomExtent; |
| 227 | 227 | $this->apikey = $apikey; |
| 228 | 228 | } |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function getMap(): string { |
| 236 | 236 | try { |
| 237 | - if($this->autoZoomExtent) { |
|
| 237 | + if ($this->autoZoomExtent) { |
|
| 238 | 238 | $this->autoZoom(); |
| 239 | 239 | } |
| 240 | - } catch(Exception $e) { |
|
| 240 | + } catch (Exception $e) { |
|
| 241 | 241 | dbglog($e); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // use map cache, so check cache for map |
| 245 | - if(!$this->checkMapCache()) { |
|
| 245 | + if (!$this->checkMapCache()) { |
|
| 246 | 246 | // map is not in cache, needs to be build |
| 247 | 247 | $this->makeMap(); |
| 248 | 248 | $this->mkdirRecursive(dirname($this->mapCacheIDToFilename()), 0777); |
@@ -262,37 +262,37 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | private function autoZoom(float $paddingFactor = 1.0): void { |
| 264 | 264 | $geoms = array(); |
| 265 | - $geoms [] = new Point ($this->lon, $this->lat); |
|
| 266 | - if(!empty ($this->markers)) { |
|
| 267 | - foreach($this->markers as $marker) { |
|
| 268 | - $geoms [] = new Point ($marker ['lon'], $marker ['lat']); |
|
| 265 | + $geoms [] = new Point($this->lon, $this->lat); |
|
| 266 | + if (!empty ($this->markers)) { |
|
| 267 | + foreach ($this->markers as $marker) { |
|
| 268 | + $geoms [] = new Point($marker ['lon'], $marker ['lat']); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | - if(file_exists($this->kmlFileName)) { |
|
| 271 | + if (file_exists($this->kmlFileName)) { |
|
| 272 | 272 | $g = geoPHP::load(file_get_contents($this->kmlFileName), 'kml'); |
| 273 | - if($g !== false) { |
|
| 273 | + if ($g !== false) { |
|
| 274 | 274 | $geoms [] = $g; |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | - if(file_exists($this->gpxFileName)) { |
|
| 277 | + if (file_exists($this->gpxFileName)) { |
|
| 278 | 278 | $g = geoPHP::load(file_get_contents($this->gpxFileName), 'gpx'); |
| 279 | - if($g !== false) { |
|
| 279 | + if ($g !== false) { |
|
| 280 | 280 | $geoms [] = $g; |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | - if(file_exists($this->geojsonFileName)) { |
|
| 283 | + if (file_exists($this->geojsonFileName)) { |
|
| 284 | 284 | $g = geoPHP::load(file_get_contents($this->geojsonFileName), 'geojson'); |
| 285 | - if($g !== false) { |
|
| 285 | + if ($g !== false) { |
|
| 286 | 286 | $geoms [] = $g; |
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if(count($geoms) <= 1) { |
|
| 290 | + if (count($geoms) <= 1) { |
|
| 291 | 291 | dbglog($geoms, "StaticMap::autoZoom: Skip setting autozoom options"); |
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $geom = new GeometryCollection ($geoms); |
|
| 295 | + $geom = new GeometryCollection($geoms); |
|
| 296 | 296 | $centroid = $geom->centroid(); |
| 297 | 297 | $bbox = $geom->getBBox(); |
| 298 | 298 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | $vy0 = log(tan(M_PI * (0.25 + $bbox ['miny'] / 360))); |
| 302 | 302 | $vy1 = log(tan(M_PI * (0.25 + $bbox ['maxy'] / 360))); |
| 303 | 303 | dbglog("StaticMap::autoZoom: vertical resolution: $vy0, $vy1"); |
| 304 | - if ($vy1 - $vy0 === 0.0){ |
|
| 304 | + if ($vy1 - $vy0 === 0.0) { |
|
| 305 | 305 | $resolutionVertical = 0; |
| 306 | 306 | dbglog("StaticMap::autoZoom: using $resolutionVertical"); |
| 307 | 307 | } else { |
@@ -313,11 +313,11 @@ discard block |
||
| 313 | 313 | dbglog("StaticMap::autoZoom: using $resolutionHorizontal"); |
| 314 | 314 | $resolution = max($resolutionHorizontal, $resolutionVertical) * $paddingFactor; |
| 315 | 315 | $zoom = $this->zoom; |
| 316 | - if ($resolution > 0){ |
|
| 316 | + if ($resolution > 0) { |
|
| 317 | 317 | $zoom = log(360 / ($resolution * $this->tileSize), 2); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if(is_finite($zoom) && $zoom < 15 && $zoom > 2) { |
|
| 320 | + if (is_finite($zoom) && $zoom < 15 && $zoom > 2) { |
|
| 321 | 321 | $this->zoom = floor($zoom); |
| 322 | 322 | } |
| 323 | 323 | $this->lon = $centroid->getX(); |
@@ -350,12 +350,12 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | public function mapCacheIDToFilename(): string { |
| 353 | - if(!$this->mapCacheFile) { |
|
| 354 | - $this->mapCacheFile = $this->mapCacheBaseDir . "/" . $this->maptype . "/" . $this->zoom . "/cache_" |
|
| 355 | - . substr($this->mapCacheID, 0, 2) . "/" . substr($this->mapCacheID, 2, 2) |
|
| 356 | - . "/" . substr($this->mapCacheID, 4); |
|
| 353 | + if (!$this->mapCacheFile) { |
|
| 354 | + $this->mapCacheFile = $this->mapCacheBaseDir."/".$this->maptype."/".$this->zoom."/cache_" |
|
| 355 | + . substr($this->mapCacheID, 0, 2)."/".substr($this->mapCacheID, 2, 2) |
|
| 356 | + . "/".substr($this->mapCacheID, 4); |
|
| 357 | 357 | } |
| 358 | - return $this->mapCacheFile . "." . $this->mapCacheExtension; |
|
| 358 | + return $this->mapCacheFile.".".$this->mapCacheExtension; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | public function makeMap(): void { |
| 365 | 365 | $this->initCoords(); |
| 366 | 366 | $this->createBaseMap(); |
| 367 | - if(!empty ($this->markers)) { |
|
| 367 | + if (!empty ($this->markers)) { |
|
| 368 | 368 | $this->placeMarkers(); |
| 369 | 369 | } |
| 370 | 370 | if (file_exists($this->kmlFileName)) { |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | $this->offsetX += floor($startX - floor($this->centerX)) * $this->tileSize; |
| 438 | 438 | $this->offsetY += floor($startY - floor($this->centerY)) * $this->tileSize; |
| 439 | 439 | |
| 440 | - for($x = $startX; $x <= $endX; $x++) { |
|
| 441 | - for($y = $startY; $y <= $endY; $y++) { |
|
| 440 | + for ($x = $startX; $x <= $endX; $x++) { |
|
| 441 | + for ($y = $startY; $y <= $endY; $y++) { |
|
| 442 | 442 | $url = str_replace( |
| 443 | 443 | array( |
| 444 | 444 | '{Z}', |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | ); |
| 453 | 453 | |
| 454 | 454 | $tileData = $this->fetchTile($url); |
| 455 | - if($tileData) { |
|
| 455 | + if ($tileData) { |
|
| 456 | 456 | $tileImage = imagecreatefromstring($tileData); |
| 457 | 457 | } else { |
| 458 | 458 | $tileImage = imagecreate($this->tileSize, $this->tileSize); |
@@ -478,17 +478,17 @@ discard block |
||
| 478 | 478 | * for better proxy handling... |
| 479 | 479 | */ |
| 480 | 480 | public function fetchTile(string $url) { |
| 481 | - if($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
| 481 | + if ($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
| 482 | 482 | return $cached; |
| 483 | 483 | |
| 484 | - $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')'; |
|
| 485 | - if(function_exists("curl_init")) { |
|
| 484 | + $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; '.PHP_OS.')'; |
|
| 485 | + if (function_exists("curl_init")) { |
|
| 486 | 486 | // use cUrl |
| 487 | 487 | $ch = curl_init(); |
| 488 | 488 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 489 | 489 | curl_setopt($ch, CURLOPT_USERAGENT, $_UA); |
| 490 | 490 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); |
| 491 | - curl_setopt($ch, CURLOPT_URL, $url . $this->apikey); |
|
| 491 | + curl_setopt($ch, CURLOPT_URL, $url.$this->apikey); |
|
| 492 | 492 | dbglog("StaticMap::fetchTile: getting: $url using curl_exec"); |
| 493 | 493 | $tile = curl_exec($ch); |
| 494 | 494 | curl_close($ch); |
@@ -498,21 +498,21 @@ discard block |
||
| 498 | 498 | $opts = array( |
| 499 | 499 | 'http' => array( |
| 500 | 500 | 'method' => "GET", |
| 501 | - 'header' => "Accept-language: en\r\n" . "User-Agent: $_UA\r\n" . "accept: image/png\r\n", |
|
| 501 | + 'header' => "Accept-language: en\r\n"."User-Agent: $_UA\r\n"."accept: image/png\r\n", |
|
| 502 | 502 | 'request_fulluri' => true |
| 503 | 503 | ) |
| 504 | 504 | ); |
| 505 | - if(isset($conf['proxy']['host'], $conf['proxy']['port']) |
|
| 505 | + if (isset($conf['proxy']['host'], $conf['proxy']['port']) |
|
| 506 | 506 | && $conf['proxy']['host'] !== '' |
| 507 | 507 | && $conf['proxy']['port'] !== '') { |
| 508 | - $opts['http'] += ['proxy' => "tcp://" . $conf['proxy']['host'] . ":" . $conf['proxy']['port']]; |
|
| 508 | + $opts['http'] += ['proxy' => "tcp://".$conf['proxy']['host'].":".$conf['proxy']['port']]; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $context = stream_context_create($opts); |
| 512 | 512 | dbglog("StaticMap::fetchTile: getting: $url . $this->apikey using file_get_contents and options $opts"); |
| 513 | - $tile = file_get_contents($url . $this->apikey, false, $context); |
|
| 513 | + $tile = file_get_contents($url.$this->apikey, false, $context); |
|
| 514 | 514 | } |
| 515 | - if($tile && $this->useTileCache) { |
|
| 515 | + if ($tile && $this->useTileCache) { |
|
| 516 | 516 | $this->writeTileToCache($url, $tile); |
| 517 | 517 | } |
| 518 | 518 | return $tile; |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | public function checkTileCache(string $url) { |
| 527 | 527 | $filename = $this->tileUrlToFilename($url); |
| 528 | - if(file_exists($filename)) { |
|
| 528 | + if (file_exists($filename)) { |
|
| 529 | 529 | return file_get_contents($filename); |
| 530 | 530 | } |
| 531 | 531 | return false; |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | * @return string |
| 538 | 538 | */ |
| 539 | 539 | public function tileUrlToFilename(string $url): string { |
| 540 | - return $this->tileCacheBaseDir . "/" . substr($url, strpos($url, '/') + 1); |
|
| 540 | + return $this->tileCacheBaseDir."/".substr($url, strpos($url, '/') + 1); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /** |
@@ -572,14 +572,14 @@ discard block |
||
| 572 | 572 | $count = 0; |
| 573 | 573 | $color = imagecolorallocate($this->image, 0, 0, 0); |
| 574 | 574 | $bgcolor = imagecolorallocate($this->image, 200, 200, 200); |
| 575 | - $markerBaseDir = __DIR__ . '/icons'; |
|
| 575 | + $markerBaseDir = __DIR__.'/icons'; |
|
| 576 | 576 | $markerImageOffsetX = 0; |
| 577 | 577 | $markerImageOffsetY = 0; |
| 578 | 578 | $markerShadowOffsetX = 0; |
| 579 | 579 | $markerShadowOffsetY = 0; |
| 580 | 580 | $markerShadowImg = null; |
| 581 | 581 | // loop thru marker array |
| 582 | - foreach($this->markers as $marker) { |
|
| 582 | + foreach ($this->markers as $marker) { |
|
| 583 | 583 | // set some local variables |
| 584 | 584 | $markerLat = $marker ['lat']; |
| 585 | 585 | $markerLon = $marker ['lon']; |
@@ -589,18 +589,18 @@ discard block |
||
| 589 | 589 | $markerShadow = ''; |
| 590 | 590 | $matches = false; |
| 591 | 591 | // check for marker type, get settings from markerPrototypes |
| 592 | - if($markerType) { |
|
| 593 | - foreach($this->markerPrototypes as $markerPrototype) { |
|
| 594 | - if(preg_match($markerPrototype ['regex'], $markerType, $matches)) { |
|
| 595 | - $markerFilename = $matches [0] . $markerPrototype ['extension']; |
|
| 596 | - if($markerPrototype ['offsetImage']) { |
|
| 592 | + if ($markerType) { |
|
| 593 | + foreach ($this->markerPrototypes as $markerPrototype) { |
|
| 594 | + if (preg_match($markerPrototype ['regex'], $markerType, $matches)) { |
|
| 595 | + $markerFilename = $matches [0].$markerPrototype ['extension']; |
|
| 596 | + if ($markerPrototype ['offsetImage']) { |
|
| 597 | 597 | list ($markerImageOffsetX, $markerImageOffsetY) = explode( |
| 598 | 598 | ",", |
| 599 | 599 | $markerPrototype ['offsetImage'] |
| 600 | 600 | ); |
| 601 | 601 | } |
| 602 | 602 | $markerShadow = $markerPrototype ['shadow']; |
| 603 | - if($markerShadow) { |
|
| 603 | + if ($markerShadow) { |
|
| 604 | 604 | list ($markerShadowOffsetX, $markerShadowOffsetY) = explode( |
| 605 | 605 | ",", |
| 606 | 606 | $markerPrototype ['offsetShadow'] |
@@ -610,14 +610,14 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | // create img resource |
| 613 | - if(file_exists($markerBaseDir . '/' . $markerFilename)) { |
|
| 614 | - $markerImg = imagecreatefrompng($markerBaseDir . '/' . $markerFilename); |
|
| 613 | + if (file_exists($markerBaseDir.'/'.$markerFilename)) { |
|
| 614 | + $markerImg = imagecreatefrompng($markerBaseDir.'/'.$markerFilename); |
|
| 615 | 615 | } else { |
| 616 | - $markerImg = imagecreatefrompng($markerBaseDir . '/marker.png'); |
|
| 616 | + $markerImg = imagecreatefrompng($markerBaseDir.'/marker.png'); |
|
| 617 | 617 | } |
| 618 | 618 | // check for shadow + create shadow recource |
| 619 | - if($markerShadow && file_exists($markerBaseDir . '/' . $markerShadow)) { |
|
| 620 | - $markerShadowImg = imagecreatefrompng($markerBaseDir . '/' . $markerShadow); |
|
| 619 | + if ($markerShadow && file_exists($markerBaseDir.'/'.$markerShadow)) { |
|
| 620 | + $markerShadowImg = imagecreatefrompng($markerBaseDir.'/'.$markerShadow); |
|
| 621 | 621 | } |
| 622 | 622 | // calc position |
| 623 | 623 | $destX = floor( |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $this->tileSize * ($this->centerY - $this->latToTile($markerLat, $this->zoom)) |
| 630 | 630 | ); |
| 631 | 631 | // copy shadow on basemap |
| 632 | - if($markerShadow && $markerShadowImg) { |
|
| 632 | + if ($markerShadow && $markerShadowImg) { |
|
| 633 | 633 | imagecopy( |
| 634 | 634 | $this->image, |
| 635 | 635 | $markerShadowImg, |
@@ -691,14 +691,14 @@ discard block |
||
| 691 | 691 | * drawing colour |
| 692 | 692 | */ |
| 693 | 693 | private function drawGeometry(Geometry $geom, int $colour): void { |
| 694 | - if(empty($geom)) { |
|
| 694 | + if (empty($geom)) { |
|
| 695 | 695 | return; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - switch($geom->geometryType()) { |
|
| 698 | + switch ($geom->geometryType()) { |
|
| 699 | 699 | case 'GeometryCollection' : |
| 700 | 700 | // recursively draw part of the collection |
| 701 | - for($i = 1; $i < $geom->numGeometries() + 1; $i++) { |
|
| 701 | + for ($i = 1; $i < $geom->numGeometries() + 1; $i++) { |
|
| 702 | 702 | $_geom = $geom->geometryN($i); |
| 703 | 703 | $this->drawGeometry($_geom, $colour); |
| 704 | 704 | } |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | // extring is a linestring actually.. |
| 741 | 741 | $extRing = $polygon->exteriorRing(); |
| 742 | 742 | |
| 743 | - for($i = 1; $i < $extRing->numGeometries(); $i++) { |
|
| 743 | + for ($i = 1; $i < $extRing->numGeometries(); $i++) { |
|
| 744 | 744 | $p1 = $extRing->geometryN($i); |
| 745 | 745 | $x = floor( |
| 746 | 746 | ($this->width / 2) - $this->tileSize * ($this->centerX - $this->lonToTile($p1->x(), $this->zoom)) |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | */ |
| 767 | 767 | private function drawLineString($line, $colour) { |
| 768 | 768 | imagesetthickness($this->image, 2); |
| 769 | - for($p = 1; $p < $line->numGeometries(); $p++) { |
|
| 769 | + for ($p = 1; $p < $line->numGeometries(); $p++) { |
|
| 770 | 770 | // get first pair of points |
| 771 | 771 | $p1 = $line->geometryN($p); |
| 772 | 772 | $p2 = $line->geometryN($p + 1); |
@@ -839,8 +839,8 @@ discard block |
||
| 839 | 839 | * add copyright and origin notice and icons to the map. |
| 840 | 840 | */ |
| 841 | 841 | public function drawCopyright() { |
| 842 | - $logoBaseDir = dirname(__FILE__) . '/' . 'logo/'; |
|
| 843 | - $logoImg = imagecreatefrompng($logoBaseDir . $this->tileInfo ['openstreetmap'] ['logo']); |
|
| 842 | + $logoBaseDir = dirname(__FILE__).'/'.'logo/'; |
|
| 843 | + $logoImg = imagecreatefrompng($logoBaseDir.$this->tileInfo ['openstreetmap'] ['logo']); |
|
| 844 | 844 | $textcolor = imagecolorallocate($this->image, 0, 0, 0); |
| 845 | 845 | $bgcolor = imagecolorallocate($this->image, 200, 200, 200); |
| 846 | 846 | |
@@ -873,11 +873,11 @@ discard block |
||
| 873 | 873 | |
| 874 | 874 | // additional tile source info, ie. who created/hosted the tiles |
| 875 | 875 | $xIconOffset = 0; |
| 876 | - if($this->maptype === 'openstreetmap') { |
|
| 876 | + if ($this->maptype === 'openstreetmap') { |
|
| 877 | 877 | $mapAuthor = "(c) OpenStreetMap maps/CC BY-SA"; |
| 878 | 878 | } else { |
| 879 | 879 | $mapAuthor = $this->tileInfo [$this->maptype] ['txt']; |
| 880 | - $iconImg = imagecreatefrompng($logoBaseDir . $this->tileInfo [$this->maptype] ['logo']); |
|
| 880 | + $iconImg = imagecreatefrompng($logoBaseDir.$this->tileInfo [$this->maptype] ['logo']); |
|
| 881 | 881 | $xIconOffset = imagesx($iconImg); |
| 882 | 882 | imagecopy( |
| 883 | 883 | $this->image, |
@@ -331,17 +331,17 @@ |
||
| 331 | 331 | public function serializeParams(): string { |
| 332 | 332 | return implode( |
| 333 | 333 | "&", array( |
| 334 | - $this->zoom, |
|
| 335 | - $this->lat, |
|
| 336 | - $this->lon, |
|
| 337 | - $this->width, |
|
| 338 | - $this->height, |
|
| 339 | - serialize($this->markers), |
|
| 340 | - $this->maptype, |
|
| 341 | - $this->kmlFileName, |
|
| 342 | - $this->gpxFileName, |
|
| 343 | - $this->geojsonFileName |
|
| 344 | - ) |
|
| 334 | + $this->zoom, |
|
| 335 | + $this->lat, |
|
| 336 | + $this->lon, |
|
| 337 | + $this->width, |
|
| 338 | + $this->height, |
|
| 339 | + serialize($this->markers), |
|
| 340 | + $this->maptype, |
|
| 341 | + $this->kmlFileName, |
|
| 342 | + $this->gpxFileName, |
|
| 343 | + $this->geojsonFileName |
|
| 344 | + ) |
|
| 345 | 345 | ); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -119,13 +119,13 @@ |
||
| 119 | 119 | // incremented for each olmap_wmslayer tag in the page source |
| 120 | 120 | static $overlaynumber = 0; |
| 121 | 121 | |
| 122 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
| 123 | - $str = '{'; |
|
| 122 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
| 123 | + $str = '{'; |
|
| 124 | 124 | foreach ($data as $key => $val) { |
| 125 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
| 125 | + $str .= "'".$key."' : '".$val."',"; |
|
| 126 | 126 | } |
| 127 | 127 | $str .= "'type':'wms'}"; |
| 128 | - $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";") |
|
| 128 | + $renderer->doc .= base64_encode("olMapOverlays['wms".$overlaynumber."'] = ".$str.";") |
|
| 129 | 129 | . '"></script>'; |
| 130 | 130 | $overlaynumber++; |
| 131 | 131 | return true; |
@@ -116,13 +116,13 @@ |
||
| 116 | 116 | // incremented for each olmap_osmlayer tag in the page source |
| 117 | 117 | static $overlaynumber = 0; |
| 118 | 118 | |
| 119 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
| 120 | - $str = '{'; |
|
| 119 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
| 120 | + $str = '{'; |
|
| 121 | 121 | foreach ($data as $key => $val) { |
| 122 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
| 122 | + $str .= "'".$key."' : '".$val."',"; |
|
| 123 | 123 | } |
| 124 | 124 | $str .= '"type":"osm"}'; |
| 125 | - $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";") |
|
| 125 | + $renderer->doc .= base64_encode("olMapOverlays['osm".$overlaynumber."'] = ".$str.";") |
|
| 126 | 126 | . '"></script>'; |
| 127 | 127 | $overlaynumber++; |
| 128 | 128 | return true; |
@@ -120,13 +120,13 @@ |
||
| 120 | 120 | // incremented for each olmap_agslayer tag in the page source |
| 121 | 121 | static $overlaynumber = 0; |
| 122 | 122 | |
| 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':'ags'}"; |
| 129 | - $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";") |
|
| 129 | + $renderer->doc .= base64_encode("olMapOverlays['ags".$overlaynumber."'] = ".$str.";") |
|
| 130 | 130 | . '"></script>'; |
| 131 | 131 | $overlaynumber++; |
| 132 | 132 | return true; |