@@ -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> |
@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // normalize zoom |
| 82 | 82 | $zoom = $zoom ?: 0; |
| 83 | - if($zoom > 18) { |
|
| 83 | + if ($zoom > 18) { |
|
| 84 | 84 | $zoom = 18; |
| 85 | 85 | } |
| 86 | 86 | // normalize WxH |
| 87 | 87 | list($width, $height) = explode('x', $size); |
| 88 | 88 | $width = (int) $width; |
| 89 | - if($width > $this->maxWidth) { |
|
| 89 | + if ($width > $this->maxWidth) { |
|
| 90 | 90 | $width = $this->maxWidth; |
| 91 | 91 | } |
| 92 | 92 | $height = (int) $height; |
| 93 | - if($height > $this->maxHeight) { |
|
| 93 | + if ($height > $this->maxHeight) { |
|
| 94 | 94 | $height = $this->maxHeight; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function mediaIdToPath(string $id): string { |
| 127 | 127 | global $conf; |
| 128 | - if(empty($id)) { |
|
| 128 | + if (empty($id)) { |
|
| 129 | 129 | return ""; |
| 130 | 130 | } |
| 131 | 131 | $id = str_replace(array("[[", "]]"), "", $id); |
| 132 | - if((strpos($id, ':') === 0)) { |
|
| 132 | + if ((strpos($id, ':') === 0)) { |
|
| 133 | 133 | $id = substr($id, 1); |
| 134 | 134 | } |
| 135 | 135 | $id = str_replace(":", "/", $id); |
| 136 | - return $conf['mediadir'] . '/' . $id; |
|
| 136 | + return $conf['mediadir'].'/'.$id; |
|
| 137 | 137 | } |
| 138 | 138 | } |
@@ -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); |
@@ -617,8 +617,9 @@ |
||
| 617 | 617 | . "%2C" . $bbox ['maxlon']; |
| 618 | 618 | $imgUrl .= "&dcl=1"; |
| 619 | 619 | } |
| 620 | - if(strpos($imgUrl, "?") === false) |
|
| 621 | - $imgUrl .= "?"; |
|
| 620 | + if(strpos($imgUrl, "?") === false) { |
|
| 621 | + $imgUrl .= "?"; |
|
| 622 | + } |
|
| 622 | 623 | |
| 623 | 624 | //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . "," |
| 624 | 625 | // . str_replace ( "px", "", $gmap ['height'] ); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | // break matched data into its components |
| 90 | 90 | $_tag = explode('>', substr($match, 7, -9), 2); |
| 91 | 91 | $str_params = $_tag[0]; |
| 92 | - if(array_key_exists(1, $_tag)) { |
|
| 92 | + if (array_key_exists(1, $_tag)) { |
|
| 93 | 93 | $str_points = $_tag[1]; |
| 94 | 94 | } else { |
| 95 | 95 | $str_points = ''; |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | preg_match('(lon[:|=]\"-?\d*\.?\d*\")', $match, $mainLon); |
| 100 | 100 | $mainLat = substr($mainLat [0], 5, -1); |
| 101 | 101 | $mainLon = substr($mainLon [0], 5, -1); |
| 102 | - if(!is_numeric($mainLat)) { |
|
| 102 | + if (!is_numeric($mainLat)) { |
|
| 103 | 103 | $mainLat = $this->dflt ['lat']; |
| 104 | 104 | } |
| 105 | - if(!is_numeric($mainLon)) { |
|
| 105 | + if (!is_numeric($mainLon)) { |
|
| 106 | 106 | $mainLon = $this->dflt ['lon']; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -113,23 +113,23 @@ discard block |
||
| 113 | 113 | $_nocache = false; |
| 114 | 114 | // choose maptype based on the specified tag |
| 115 | 115 | $imgUrl = "{{"; |
| 116 | - if(stripos($gmap ['baselyr'], 'google') !== false) { |
|
| 116 | + if (stripos($gmap ['baselyr'], 'google') !== false) { |
|
| 117 | 117 | |
| 118 | 118 | $imgUrl .= $this->getGoogle($gmap, $overlay); |
| 119 | 119 | $imgUrl .= "&.png"; |
| 120 | - } elseif(stripos($gmap ['baselyr'], 'bing') !== false) { |
|
| 120 | + } elseif (stripos($gmap ['baselyr'], 'bing') !== false) { |
|
| 121 | 121 | // Bing |
| 122 | - if(!$this->getConf('bingAPIKey')) { |
|
| 122 | + if (!$this->getConf('bingAPIKey')) { |
|
| 123 | 123 | // in case there is no Bing api key we'll use OSM |
| 124 | 124 | $_firstimageID = $this->getStaticOSM($gmap, $overlay); |
| 125 | - $imgUrl .= $_firstimageID; |
|
| 126 | - if($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 125 | + $imgUrl .= $_firstimageID; |
|
| 126 | + if ($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 127 | 127 | $imgUrl .= "&.png"; |
| 128 | 128 | } |
| 129 | 129 | } else { |
| 130 | 130 | // seems that Bing doesn't like the DW client, turn off caching |
| 131 | 131 | $_nocache = true; |
| 132 | - $imgUrl .= $this->getBing($gmap, $overlay) . "&.png"; |
|
| 132 | + $imgUrl .= $this->getBing($gmap, $overlay)."&.png"; |
|
| 133 | 133 | } |
| 134 | 134 | } /* elseif (stripos ( $gmap ['baselyr'], 'mapquest' ) !== false) { |
| 135 | 135 | // MapQuest |
@@ -147,33 +147,33 @@ discard block |
||
| 147 | 147 | } */ else { |
| 148 | 148 | // default OSM |
| 149 | 149 | $_firstimageID = $this->getStaticOSM($gmap, $overlay); |
| 150 | - $imgUrl .= $_firstimageID; |
|
| 151 | - if($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 150 | + $imgUrl .= $_firstimageID; |
|
| 151 | + if ($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 152 | 152 | $imgUrl .= "&.png"; |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // append dw p_render specific params and render |
| 157 | - $imgUrl .= "?" . str_replace("px", "", $gmap ['width']) . "x" |
|
| 157 | + $imgUrl .= "?".str_replace("px", "", $gmap ['width'])."x" |
|
| 158 | 158 | . str_replace("px", "", $gmap ['height']); |
| 159 | 159 | $imgUrl .= "&nolink"; |
| 160 | 160 | |
| 161 | 161 | // add nocache option for selected services |
| 162 | - if($_nocache) { |
|
| 162 | + if ($_nocache) { |
|
| 163 | 163 | $imgUrl .= "&nocache"; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $imgUrl .= " |" . $gmap ['summary'] . " }}"; |
|
| 166 | + $imgUrl .= " |".$gmap ['summary']." }}"; |
|
| 167 | 167 | |
| 168 | 168 | // dbglog($imgUrl,"complete image tags is:"); |
| 169 | 169 | |
| 170 | 170 | $mapid = $gmap ['id']; |
| 171 | 171 | // create a javascript parameter string for the map |
| 172 | 172 | $param = ''; |
| 173 | - foreach($gmap as $key => $val) { |
|
| 174 | - $param .= is_numeric($val) ? "$key: $val, " : "$key: '" . hsc($val) . "', "; |
|
| 173 | + foreach ($gmap as $key => $val) { |
|
| 174 | + $param .= is_numeric($val) ? "$key: $val, " : "$key: '".hsc($val)."', "; |
|
| 175 | 175 | } |
| 176 | - if(!empty ($param)) { |
|
| 176 | + if (!empty ($param)) { |
|
| 177 | 177 | $param = substr($param, 0, -2); |
| 178 | 178 | } |
| 179 | 179 | unset ($gmap ['id']); |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | $poi = ''; |
| 183 | 183 | $poitable = ''; |
| 184 | 184 | $rowId = 0; |
| 185 | - if(!empty ($overlay)) { |
|
| 186 | - foreach($overlay as $data) { |
|
| 185 | + if (!empty ($overlay)) { |
|
| 186 | + foreach ($overlay as $data) { |
|
| 187 | 187 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 188 | 188 | $rowId++; |
| 189 | 189 | $poi .= ", {lat:$lat,lon:$lon,txt:'$text',angle:$angle,opacity:$opacity,img:'$img',rowId: $rowId}"; |
| 190 | 190 | |
| 191 | - if($this->getConf('displayformat') === 'DMS') { |
|
| 191 | + if ($this->getConf('displayformat') === 'DMS') { |
|
| 192 | 192 | $lat = $this->convertLat($lat); |
| 193 | 193 | $lon = $this->convertLon($lon); |
| 194 | 194 | } else { |
@@ -198,52 +198,52 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $poitable .= ' |
| 200 | 200 | <tr> |
| 201 | - <td class="rowId">' . $rowId . '</td> |
|
| 202 | - <td class="icon"><img src="' . DOKU_BASE . 'lib/plugins/openlayersmap/icons/' . $img . '" alt="' |
|
| 203 | - . substr($img, 0, -4) . $this->getlang('alt_legend_poi') . '" /></td> |
|
| 204 | - <td class="lat" title="' . $this->getLang('olmapPOIlatTitle') . '">' . $lat . '</td> |
|
| 205 | - <td class="lon" title="' . $this->getLang('olmapPOIlonTitle') . '">' . $lon . '</td> |
|
| 206 | - <td class="txt">' . $text . '</td> |
|
| 201 | + <td class="rowId">' . $rowId.'</td> |
|
| 202 | + <td class="icon"><img src="' . DOKU_BASE.'lib/plugins/openlayersmap/icons/'.$img.'" alt="' |
|
| 203 | + . substr($img, 0, -4).$this->getlang('alt_legend_poi').'" /></td> |
|
| 204 | + <td class="lat" title="' . $this->getLang('olmapPOIlatTitle').'">'.$lat.'</td> |
|
| 205 | + <td class="lon" title="' . $this->getLang('olmapPOIlonTitle').'">'.$lon.'</td> |
|
| 206 | + <td class="txt">' . $text.'</td> |
|
| 207 | 207 | </tr>'; |
| 208 | 208 | } |
| 209 | 209 | $poi = substr($poi, 2); |
| 210 | 210 | } |
| 211 | - if(!empty ($gmap ['kmlfile'])) { |
|
| 211 | + if (!empty ($gmap ['kmlfile'])) { |
|
| 212 | 212 | $poitable .= ' |
| 213 | 213 | <tr> |
| 214 | 214 | <td class="rowId"><img src="' . DOKU_BASE |
| 215 | 215 | . 'lib/plugins/openlayersmap/toolbar/kml_file.png" alt="KML file" /></td> |
| 216 | - <td class="icon"><img src="' . DOKU_BASE . 'lib/plugins/openlayersmap/toolbar/kml_line.png" alt="' |
|
| 217 | - . $this->getlang('alt_legend_kml') . '" /></td> |
|
| 218 | - <td class="txt" colspan="3">KML track: ' . $this->getFileName($gmap ['kmlfile']) . '</td> |
|
| 216 | + <td class="icon"><img src="' . DOKU_BASE.'lib/plugins/openlayersmap/toolbar/kml_line.png" alt="' |
|
| 217 | + . $this->getlang('alt_legend_kml').'" /></td> |
|
| 218 | + <td class="txt" colspan="3">KML track: ' . $this->getFileName($gmap ['kmlfile']).'</td> |
|
| 219 | 219 | </tr>'; |
| 220 | 220 | } |
| 221 | - if(!empty ($gmap ['gpxfile'])) { |
|
| 221 | + if (!empty ($gmap ['gpxfile'])) { |
|
| 222 | 222 | $poitable .= ' |
| 223 | 223 | <tr> |
| 224 | 224 | <td class="rowId"><img src="' . DOKU_BASE |
| 225 | 225 | . 'lib/plugins/openlayersmap/toolbar/gpx_file.png" alt="GPX file" /></td> |
| 226 | 226 | <td class="icon"><img src="' . DOKU_BASE |
| 227 | 227 | . 'lib/plugins/openlayersmap/toolbar/gpx_line.png" alt="' |
| 228 | - . $this->getlang('alt_legend_gpx') . '" /></td> |
|
| 229 | - <td class="txt" colspan="3">GPX track: ' . $this->getFileName($gmap ['gpxfile']) . '</td> |
|
| 228 | + . $this->getlang('alt_legend_gpx').'" /></td> |
|
| 229 | + <td class="txt" colspan="3">GPX track: ' . $this->getFileName($gmap ['gpxfile']).'</td> |
|
| 230 | 230 | </tr>'; |
| 231 | 231 | } |
| 232 | - if(!empty ($gmap ['geojsonfile'])) { |
|
| 232 | + if (!empty ($gmap ['geojsonfile'])) { |
|
| 233 | 233 | $poitable .= ' |
| 234 | 234 | <tr> |
| 235 | 235 | <td class="rowId"><img src="' . DOKU_BASE |
| 236 | 236 | . 'lib/plugins/openlayersmap/toolbar/geojson_file.png" alt="GeoJSON file" /></td> |
| 237 | 237 | <td class="icon"><img src="' . DOKU_BASE |
| 238 | 238 | . 'lib/plugins/openlayersmap/toolbar/geojson_line.png" alt="' |
| 239 | - . $this->getlang('alt_legend_geojson') . '" /></td> |
|
| 240 | - <td class="txt" colspan="3">GeoJSON track: ' . $this->getFileName($gmap ['geojsonfile']) . '</td> |
|
| 239 | + . $this->getlang('alt_legend_geojson').'" /></td> |
|
| 240 | + <td class="txt" colspan="3">GeoJSON track: ' . $this->getFileName($gmap ['geojsonfile']).'</td> |
|
| 241 | 241 | </tr>'; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $autozoom = empty ($gmap ['autozoom']) ? $this->getConf('autoZoomMap') : $gmap ['autozoom']; |
| 245 | - $js = "{mapOpts: {" . $param . ", displayformat: '" . $this->getConf('displayformat') |
|
| 246 | - . "', autozoom: " . $autozoom . "}, poi: [$poi]};"; |
|
| 245 | + $js = "{mapOpts: {".$param.", displayformat: '".$this->getConf('displayformat') |
|
| 246 | + . "', autozoom: ".$autozoom."}, poi: [$poi]};"; |
|
| 247 | 247 | // unescape the json |
| 248 | 248 | $poitable = stripslashes($poitable); |
| 249 | 249 | |
@@ -271,21 +271,21 @@ discard block |
||
| 271 | 271 | preg_match_all('/(\w*)="(.*?)"/us', $str_params, $param, PREG_SET_ORDER); |
| 272 | 272 | // parse match for instructions, break into key value pairs |
| 273 | 273 | $gmap = $this->dflt; |
| 274 | - foreach($gmap as $key => &$value) { |
|
| 275 | - $defval = $this->getConf('default_' . $key); |
|
| 276 | - if($defval !== '') { |
|
| 274 | + foreach ($gmap as $key => &$value) { |
|
| 275 | + $defval = $this->getConf('default_'.$key); |
|
| 276 | + if ($defval !== '') { |
|
| 277 | 277 | $value = $defval; |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | unset ($value); |
| 281 | - foreach($param as $kvpair) { |
|
| 281 | + foreach ($param as $kvpair) { |
|
| 282 | 282 | list ($match, $key, $val) = $kvpair; |
| 283 | 283 | $key = strtolower($key); |
| 284 | - if(isset ($gmap [$key])) { |
|
| 285 | - if($key == 'summary') { |
|
| 284 | + if (isset ($gmap [$key])) { |
|
| 285 | + if ($key == 'summary') { |
|
| 286 | 286 | // preserve case for summary field |
| 287 | 287 | $gmap [$key] = $val; |
| 288 | - } elseif($key == 'id') { |
|
| 288 | + } elseif ($key == 'id') { |
|
| 289 | 289 | // preserve case for id field |
| 290 | 290 | $gmap [$key] = $val; |
| 291 | 291 | } else { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | ); |
| 322 | 322 | // create poi array |
| 323 | 323 | $overlay = array(); |
| 324 | - foreach($point as $pt) { |
|
| 324 | + foreach ($point as $pt) { |
|
| 325 | 325 | list ($match, $lat, $lon, $angle, $opacity, $img, $text) = $pt; |
| 326 | 326 | $lat = is_numeric($lat) ? $lat : 0; |
| 327 | 327 | $lon = is_numeric($lon) ? $lon : 0; |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | private function getGoogle(array $gmap, array $overlay): string { |
| 357 | 357 | $sUrl = $this->getConf('iconUrlOverload'); |
| 358 | - if(!$sUrl) { |
|
| 358 | + if (!$sUrl) { |
|
| 359 | 359 | $sUrl = DOKU_URL; |
| 360 | 360 | } |
| 361 | - switch($gmap ['baselyr']) { |
|
| 361 | + switch ($gmap ['baselyr']) { |
|
| 362 | 362 | case 'google hybrid' : |
| 363 | 363 | $maptype = 'hybrid'; |
| 364 | 364 | break; |
@@ -378,29 +378,29 @@ discard block |
||
| 378 | 378 | // see: https://developers.google.com/maps/documentation/staticmaps/index#Viewports |
| 379 | 379 | // http://maps.google.com/maps/api/staticmap?center=51.565690,5.456756&zoom=16&size=600x400&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/marker.png|label:1|51.565690,5.456756&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/marker-blue.png|51.566197,5.458966|label:2&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/parking.png|51.567177,5.457909|label:3&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/parking.png|51.566283,5.457330|label:4&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/parking.png|51.565630,5.457695|label:5&sensor=false&format=png&maptype=roadmap |
| 380 | 380 | $imgUrl = "https://maps.googleapis.com/maps/api/staticmap?"; |
| 381 | - $imgUrl .= "&size=" . str_replace("px", "", $gmap ['width']) . "x" |
|
| 381 | + $imgUrl .= "&size=".str_replace("px", "", $gmap ['width'])."x" |
|
| 382 | 382 | . str_replace("px", "", $gmap ['height']); |
| 383 | 383 | //if (!$this->getConf( 'autoZoomMap')) { // no need for center & zoom params } |
| 384 | - $imgUrl .= "¢er=" . $gmap ['lat'] . "," . $gmap ['lon']; |
|
| 384 | + $imgUrl .= "¢er=".$gmap ['lat'].",".$gmap ['lon']; |
|
| 385 | 385 | // max is 21 (== building scale), but that's overkill.. |
| 386 | - if($gmap ['zoom'] > 17) { |
|
| 386 | + if ($gmap ['zoom'] > 17) { |
|
| 387 | 387 | $imgUrl .= "&zoom=17"; |
| 388 | 388 | } else { |
| 389 | - $imgUrl .= "&zoom=" . $gmap ['zoom']; |
|
| 389 | + $imgUrl .= "&zoom=".$gmap ['zoom']; |
|
| 390 | 390 | } |
| 391 | - if(!empty ($overlay)) { |
|
| 391 | + if (!empty ($overlay)) { |
|
| 392 | 392 | $rowId = 0; |
| 393 | - foreach($overlay as $data) { |
|
| 393 | + foreach ($overlay as $data) { |
|
| 394 | 394 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 395 | - $imgUrl .= "&markers=icon%3a" . $sUrl . "lib/plugins/openlayersmap/icons/" . $img . "%7c" |
|
| 396 | - . $lat . "," . $lon . "%7clabel%3a" . ++$rowId; |
|
| 395 | + $imgUrl .= "&markers=icon%3a".$sUrl."lib/plugins/openlayersmap/icons/".$img."%7c" |
|
| 396 | + . $lat.",".$lon."%7clabel%3a".++$rowId; |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | - $imgUrl .= "&format=png&maptype=" . $maptype; |
|
| 399 | + $imgUrl .= "&format=png&maptype=".$maptype; |
|
| 400 | 400 | global $conf; |
| 401 | - $imgUrl .= "&language=" . $conf ['lang']; |
|
| 402 | - if($this->getConf('googleAPIkey')) { |
|
| 403 | - $imgUrl .= "&key=" . $this->getConf('googleAPIkey'); |
|
| 401 | + $imgUrl .= "&language=".$conf ['lang']; |
|
| 402 | + if ($this->getConf('googleAPIkey')) { |
|
| 403 | + $imgUrl .= "&key=".$this->getConf('googleAPIkey'); |
|
| 404 | 404 | } |
| 405 | 405 | // dbglog($imgUrl,'syntax_plugin_openlayersmap_olmap::getGoogle: Google image url is:'); |
| 406 | 406 | return $imgUrl; |
@@ -483,23 +483,23 @@ discard block |
||
| 483 | 483 | private function getStaticOSM(array $gmap, array $overlay) { |
| 484 | 484 | global $conf; |
| 485 | 485 | |
| 486 | - if($this->getConf('optionStaticMapGenerator') == 'local') { |
|
| 486 | + if ($this->getConf('optionStaticMapGenerator') == 'local') { |
|
| 487 | 487 | // using local basemap composer |
| 488 | - if(!$myMap = plugin_load('helper', 'openlayersmap_staticmap')) { |
|
| 488 | + if (!$myMap = plugin_load('helper', 'openlayersmap_staticmap')) { |
|
| 489 | 489 | dbglog( |
| 490 | 490 | $myMap, |
| 491 | 491 | 'openlayersmap_staticmap plugin is not available for use.' |
| 492 | 492 | ); |
| 493 | 493 | } |
| 494 | - if(!$geophp = plugin_load('helper', 'geophp')) { |
|
| 494 | + if (!$geophp = plugin_load('helper', 'geophp')) { |
|
| 495 | 495 | dbglog($geophp, 'geophp plugin is not available for use.'); |
| 496 | 496 | } |
| 497 | - $size = str_replace("px", "", $gmap ['width']) . "x" |
|
| 497 | + $size = str_replace("px", "", $gmap ['width'])."x" |
|
| 498 | 498 | . str_replace("px", "", $gmap ['height']); |
| 499 | 499 | |
| 500 | 500 | $markers = array(); |
| 501 | - if(!empty ($overlay)) { |
|
| 502 | - foreach($overlay as $data) { |
|
| 501 | + if (!empty ($overlay)) { |
|
| 502 | + foreach ($overlay as $data) { |
|
| 503 | 503 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 504 | 504 | $iconStyle = substr($img, 0, strlen($img) - 4); |
| 505 | 505 | $markers [] = array( |
@@ -511,26 +511,26 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | $apikey = ''; |
| 514 | - switch($gmap ['baselyr']) { |
|
| 514 | + switch ($gmap ['baselyr']) { |
|
| 515 | 515 | case 'mapnik' : |
| 516 | 516 | case 'openstreetmap' : |
| 517 | 517 | $maptype = 'openstreetmap'; |
| 518 | 518 | break; |
| 519 | 519 | case 'transport' : |
| 520 | 520 | $maptype = 'transport'; |
| 521 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 521 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 522 | 522 | break; |
| 523 | 523 | case 'landscape' : |
| 524 | 524 | $maptype = 'landscape'; |
| 525 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 525 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 526 | 526 | break; |
| 527 | 527 | case 'outdoors' : |
| 528 | 528 | $maptype = 'outdoors'; |
| 529 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 529 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 530 | 530 | break; |
| 531 | 531 | case 'cycle map' : |
| 532 | 532 | $maptype = 'cycle'; |
| 533 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 533 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 534 | 534 | break; |
| 535 | 535 | case 'hike and bike map' : |
| 536 | 536 | $maptype = 'hikeandbike'; |
@@ -559,25 +559,25 @@ discard block |
||
| 559 | 559 | // ol-marker|47.921629720114,18.027343747285,ol-marker-gold|47.951071133739,19.257812497236, |
| 560 | 560 | // ol-marker-blue|47.180141361692,19.257812497236,ol-marker-green |
| 561 | 561 | $imgUrl = "https://staticmap.openstreetmap.de/staticmap.php"; |
| 562 | - $imgUrl .= "?center=" . $gmap ['lat'] . "," . $gmap ['lon']; |
|
| 563 | - $imgUrl .= "&size=" . str_replace("px", "", $gmap ['width']) . "x" |
|
| 562 | + $imgUrl .= "?center=".$gmap ['lat'].",".$gmap ['lon']; |
|
| 563 | + $imgUrl .= "&size=".str_replace("px", "", $gmap ['width'])."x" |
|
| 564 | 564 | . str_replace("px", "", $gmap ['height']); |
| 565 | 565 | |
| 566 | - if($gmap ['zoom'] > 16) { |
|
| 566 | + if ($gmap ['zoom'] > 16) { |
|
| 567 | 567 | // actually this could even be 18, but that seems overkill |
| 568 | 568 | $imgUrl .= "&zoom=16"; |
| 569 | 569 | } else { |
| 570 | - $imgUrl .= "&zoom=" . $gmap ['zoom']; |
|
| 570 | + $imgUrl .= "&zoom=".$gmap ['zoom']; |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if(!empty ($overlay)) { |
|
| 574 | - $rowId = 0; |
|
| 573 | + if (!empty ($overlay)) { |
|
| 574 | + $rowId = 0; |
|
| 575 | 575 | $imgUrl .= "&markers="; |
| 576 | - foreach($overlay as $data) { |
|
| 576 | + foreach ($overlay as $data) { |
|
| 577 | 577 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 578 | 578 | $rowId++; |
| 579 | 579 | $iconStyle = "lightblue$rowId"; |
| 580 | - $imgUrl .= "$lat,$lon,$iconStyle%7c"; |
|
| 580 | + $imgUrl .= "$lat,$lon,$iconStyle%7c"; |
|
| 581 | 581 | } |
| 582 | 582 | $imgUrl = substr($imgUrl, 0, -3); |
| 583 | 583 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * @return string |
| 597 | 597 | */ |
| 598 | 598 | private function getBing(array $gmap, array $overlay): string { |
| 599 | - switch($gmap ['baselyr']) { |
|
| 599 | + switch ($gmap ['baselyr']) { |
|
| 600 | 600 | case 've hybrid' : |
| 601 | 601 | case 'bing hybrid' : |
| 602 | 602 | $maptype = 'AerialWithLabels'; |
@@ -613,33 +613,33 @@ discard block |
||
| 613 | 613 | $maptype = 'Road'; |
| 614 | 614 | break; |
| 615 | 615 | } |
| 616 | - $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/" . $maptype;// . "/"; |
|
| 617 | - if($this->getConf('autoZoomMap')) { |
|
| 616 | + $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/".$maptype; // . "/"; |
|
| 617 | + if ($this->getConf('autoZoomMap')) { |
|
| 618 | 618 | $bbox = $this->calcBBOX($overlay, $gmap ['lat'], $gmap ['lon']); |
| 619 | 619 | //$imgUrl .= "?ma=" . $bbox ['minlat'] . "," . $bbox ['minlon'] . "," |
| 620 | 620 | // . $bbox ['maxlat'] . "," . $bbox ['maxlon']; |
| 621 | - $imgUrl .= "?ma=" . $bbox ['minlat'] . "%2C" . $bbox ['minlon'] . "%2C" . $bbox ['maxlat'] |
|
| 622 | - . "%2C" . $bbox ['maxlon']; |
|
| 621 | + $imgUrl .= "?ma=".$bbox ['minlat']."%2C".$bbox ['minlon']."%2C".$bbox ['maxlat'] |
|
| 622 | + . "%2C".$bbox ['maxlon']; |
|
| 623 | 623 | $imgUrl .= "&dcl=1"; |
| 624 | 624 | } |
| 625 | - if(strpos($imgUrl, "?") === false) |
|
| 625 | + if (strpos($imgUrl, "?") === false) |
|
| 626 | 626 | $imgUrl .= "?"; |
| 627 | 627 | |
| 628 | 628 | //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . "," |
| 629 | 629 | // . str_replace ( "px", "", $gmap ['height'] ); |
| 630 | - $imgUrl .= "&ms=" . str_replace("px", "", $gmap ['width']) . "%2C" |
|
| 630 | + $imgUrl .= "&ms=".str_replace("px", "", $gmap ['width'])."%2C" |
|
| 631 | 631 | . str_replace("px", "", $gmap ['height']); |
| 632 | - $imgUrl .= "&key=" . $this->getConf('bingAPIKey'); |
|
| 633 | - if(!empty ($overlay)) { |
|
| 632 | + $imgUrl .= "&key=".$this->getConf('bingAPIKey'); |
|
| 633 | + if (!empty ($overlay)) { |
|
| 634 | 634 | $rowId = 0; |
| 635 | - foreach($overlay as $data) { |
|
| 635 | + foreach ($overlay as $data) { |
|
| 636 | 636 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 637 | 637 | // TODO icon style lookup, see: http://msdn.microsoft.com/en-us/library/ff701719.aspx for iconStyle |
| 638 | 638 | $iconStyle = 32; |
| 639 | 639 | $rowId++; |
| 640 | 640 | // NOTE: the max number of pushpins is 18! or we have to use POST |
| 641 | 641 | // (http://msdn.microsoft.com/en-us/library/ff701724.aspx) |
| 642 | - if($rowId == 18) { |
|
| 642 | + if ($rowId == 18) { |
|
| 643 | 643 | break; |
| 644 | 644 | } |
| 645 | 645 | //$imgUrl .= "&pp=$lat,$lon;$iconStyle;$rowId"; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | global $conf; |
| 651 | 651 | $imgUrl .= "&fmt=png"; |
| 652 | - $imgUrl .= "&c=" . $conf ['lang']; |
|
| 652 | + $imgUrl .= "&c=".$conf ['lang']; |
|
| 653 | 653 | // dbglog($imgUrl,'syntax_plugin_openlayersmap_olmap::getBing: bing image url is:'); |
| 654 | 654 | return $imgUrl; |
| 655 | 655 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | private function calcBBOX(array $overlay, float $lat, float $lon): array { |
| 669 | 669 | $lats = array($lat); |
| 670 | 670 | $lons = array($lon); |
| 671 | - foreach($overlay as $data) { |
|
| 671 | + foreach ($overlay as $data) { |
|
| 672 | 672 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 673 | 673 | $lats [] = $lat; |
| 674 | 674 | $lons [] = $lon; |
@@ -696,13 +696,13 @@ discard block |
||
| 696 | 696 | * @todo move this into a shared library |
| 697 | 697 | */ |
| 698 | 698 | private function convertLat(float $decimaldegrees): string { |
| 699 | - if(strpos($decimaldegrees, '-') !== false) { |
|
| 699 | + if (strpos($decimaldegrees, '-') !== false) { |
|
| 700 | 700 | $latPos = "S"; |
| 701 | 701 | } else { |
| 702 | 702 | $latPos = "N"; |
| 703 | 703 | } |
| 704 | 704 | $dms = $this->convertDDtoDMS(abs($decimaldegrees)); |
| 705 | - return hsc($dms . $latPos); |
|
| 705 | + return hsc($dms.$latPos); |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | $secs = ($decimaldegrees - $dms) * 3600; |
| 718 | 718 | $min = floor($secs / 60); |
| 719 | 719 | $sec = round($secs - ($min * 60), 3); |
| 720 | - $dms .= 'º' . $min . '\'' . $sec . '"'; |
|
| 720 | + $dms .= 'º'.$min.'\''.$sec.'"'; |
|
| 721 | 721 | return $dms; |
| 722 | 722 | } |
| 723 | 723 | |
@@ -729,13 +729,13 @@ discard block |
||
| 729 | 729 | * @todo move this into a shared library |
| 730 | 730 | */ |
| 731 | 731 | private function convertLon(float $decimaldegrees): string { |
| 732 | - if(strpos($decimaldegrees, '-') !== false) { |
|
| 732 | + if (strpos($decimaldegrees, '-') !== false) { |
|
| 733 | 733 | $lonPos = "W"; |
| 734 | 734 | } else { |
| 735 | 735 | $lonPos = "E"; |
| 736 | 736 | } |
| 737 | 737 | $dms = $this->convertDDtoDMS(abs($decimaldegrees)); |
| 738 | - return hsc($dms . $lonPos); |
|
| 738 | + return hsc($dms.$lonPos); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -766,60 +766,60 @@ discard block |
||
| 766 | 766 | // dbglog($data, 'olmap::render() data.'); |
| 767 | 767 | list ($mapid, $param, $mainLat, $mainLon, $poitable, $poitabledesc, $staticImgUrl, $_firstimage) = $data; |
| 768 | 768 | |
| 769 | - if($format == 'xhtml') { |
|
| 769 | + if ($format == 'xhtml') { |
|
| 770 | 770 | $olscript = ''; |
| 771 | 771 | $stamenEnable = $this->getConf('enableStamen'); |
| 772 | 772 | $osmEnable = $this->getConf('enableOSM'); |
| 773 | 773 | $enableBing = $this->getConf('enableBing'); |
| 774 | 774 | |
| 775 | 775 | $scriptEnable = ''; |
| 776 | - if(!$initialised) { |
|
| 776 | + if (!$initialised) { |
|
| 777 | 777 | $initialised = true; |
| 778 | 778 | // render necessary script tags only once |
| 779 | - $olscript = '<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol7/ol.js"></script> |
|
| 780 | -<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol7/ol-layerswitcher.js"></script>'; |
|
| 779 | + $olscript = '<script defer="defer" src="'.DOKU_BASE.'lib/plugins/openlayersmap/ol7/ol.js"></script> |
|
| 780 | +<script defer="defer" src="' . DOKU_BASE.'lib/plugins/openlayersmap/ol7/ol-layerswitcher.js"></script>'; |
|
| 781 | 781 | |
| 782 | 782 | $scriptEnable = '<script defer="defer" src="data:text/javascript;base64,'; |
| 783 | 783 | $scriptSrc = $olscript ? 'const olEnable=true;' : 'const olEnable=false;'; |
| 784 | - $scriptSrc .= 'const osmEnable=' . ($osmEnable ? 'true' : 'false') . ';'; |
|
| 785 | - $scriptSrc .= 'const stamenEnable=' . ($stamenEnable ? 'true' : 'false') . ';'; |
|
| 786 | - $scriptSrc .= 'const bEnable=' . ($enableBing ? 'true' : 'false') . ';'; |
|
| 787 | - $scriptSrc .= 'const bApiKey="' . $this->getConf('bingAPIKey') . '";'; |
|
| 788 | - $scriptSrc .= 'const tfApiKey="' . $this->getConf('tfApiKey') . '";'; |
|
| 789 | - $scriptSrc .= 'const gApiKey="' . $this->getConf('googleAPIkey') . '";'; |
|
| 784 | + $scriptSrc .= 'const osmEnable='.($osmEnable ? 'true' : 'false').';'; |
|
| 785 | + $scriptSrc .= 'const stamenEnable='.($stamenEnable ? 'true' : 'false').';'; |
|
| 786 | + $scriptSrc .= 'const bEnable='.($enableBing ? 'true' : 'false').';'; |
|
| 787 | + $scriptSrc .= 'const bApiKey="'.$this->getConf('bingAPIKey').'";'; |
|
| 788 | + $scriptSrc .= 'const tfApiKey="'.$this->getConf('tfApiKey').'";'; |
|
| 789 | + $scriptSrc .= 'const gApiKey="'.$this->getConf('googleAPIkey').'";'; |
|
| 790 | 790 | $scriptSrc .= 'olMapData = []; let olMaps = {}; let olMapOverlays = {};'; |
| 791 | 791 | $scriptEnable .= base64_encode($scriptSrc); |
| 792 | 792 | $scriptEnable .= '"></script>'; |
| 793 | 793 | } |
| 794 | 794 | $renderer->doc .= "$olscript\n$scriptEnable"; |
| 795 | - $renderer->doc .= '<div class="olMapHelp">' . $this->locale_xhtml("help") . '</div>'; |
|
| 796 | - if($this->getConf('enableA11y')) { |
|
| 797 | - $renderer->doc .= '<div id="' . $mapid . '-static" class="olStaticMap">' |
|
| 798 | - . p_render($format, p_get_instructions($staticImgUrl), $info) . '</div>'; |
|
| 795 | + $renderer->doc .= '<div class="olMapHelp">'.$this->locale_xhtml("help").'</div>'; |
|
| 796 | + if ($this->getConf('enableA11y')) { |
|
| 797 | + $renderer->doc .= '<div id="'.$mapid.'-static" class="olStaticMap">' |
|
| 798 | + . p_render($format, p_get_instructions($staticImgUrl), $info).'</div>'; |
|
| 799 | 799 | } |
| 800 | - $renderer->doc .= '<div id="' . $mapid . '-clearer" class="clearer"><p> </p></div>'; |
|
| 801 | - if($this->getConf('enableA11y')) { |
|
| 800 | + $renderer->doc .= '<div id="'.$mapid.'-clearer" class="clearer"><p> </p></div>'; |
|
| 801 | + if ($this->getConf('enableA11y')) { |
|
| 802 | 802 | // render a table of the POI for the print and a11y presentation, it is hidden using javascript |
| 803 | 803 | $renderer->doc .= ' |
| 804 | - <div id="' . $mapid . '-table-span" class="olPOItableSpan"> |
|
| 805 | - <table id="' . $mapid . '-table" class="olPOItable"> |
|
| 806 | - <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle') . '</caption> |
|
| 804 | + <div id="' . $mapid.'-table-span" class="olPOItableSpan"> |
|
| 805 | + <table id="' . $mapid.'-table" class="olPOItable"> |
|
| 806 | + <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle').'</caption> |
|
| 807 | 807 | <thead class="olPOITblHeader"> |
| 808 | 808 | <tr> |
| 809 | 809 | <th class="rowId" scope="col">id</th> |
| 810 | - <th class="icon" scope="col">' . $this->getLang('olmapPOIicon') . '</th> |
|
| 811 | - <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle') . '">' |
|
| 812 | - . $this->getLang('olmapPOIlat') . '</th> |
|
| 813 | - <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle') . '">' |
|
| 814 | - . $this->getLang('olmapPOIlon') . '</th> |
|
| 815 | - <th class="txt" scope="col">' . $this->getLang('olmapPOItxt') . '</th> |
|
| 810 | + <th class="icon" scope="col">' . $this->getLang('olmapPOIicon').'</th> |
|
| 811 | + <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle').'">' |
|
| 812 | + . $this->getLang('olmapPOIlat').'</th> |
|
| 813 | + <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle').'">' |
|
| 814 | + . $this->getLang('olmapPOIlon').'</th> |
|
| 815 | + <th class="txt" scope="col">' . $this->getLang('olmapPOItxt').'</th> |
|
| 816 | 816 | </tr> |
| 817 | 817 | </thead>'; |
| 818 | - if($poitabledesc != '') { |
|
| 819 | - $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">' . $poitabledesc |
|
| 818 | + if ($poitabledesc != '') { |
|
| 819 | + $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">'.$poitabledesc |
|
| 820 | 820 | . '</td></tr></tfoot>'; |
| 821 | 821 | } |
| 822 | - $renderer->doc .= '<tbody class="olPOITblBody">' . $poitable . '</tbody> |
|
| 822 | + $renderer->doc .= '<tbody class="olPOITblBody">'.$poitable.'</tbody> |
|
| 823 | 823 | </table> |
| 824 | 824 | </div>'; |
| 825 | 825 | $renderer->doc .= "\n"; |
@@ -830,28 +830,28 @@ discard block |
||
| 830 | 830 | $renderer->doc .= '"></script>'; |
| 831 | 831 | $mapnumber++; |
| 832 | 832 | return true; |
| 833 | - } elseif($format == 'metadata') { |
|
| 834 | - if(!(($this->dflt ['lat'] == $mainLat) && ($this->dflt ['lon'] == $mainLon))) { |
|
| 833 | + } elseif ($format == 'metadata') { |
|
| 834 | + if (!(($this->dflt ['lat'] == $mainLat) && ($this->dflt ['lon'] == $mainLon))) { |
|
| 835 | 835 | // render geo metadata, unless they are the default |
| 836 | 836 | $renderer->meta ['geo'] ['lat'] = $mainLat; |
| 837 | 837 | $renderer->meta ['geo'] ['lon'] = $mainLon; |
| 838 | - if($geophp = plugin_load('helper', 'geophp')) { |
|
| 838 | + if ($geophp = plugin_load('helper', 'geophp')) { |
|
| 839 | 839 | // if we have the geoPHP helper, add the geohash |
| 840 | 840 | |
| 841 | 841 | // fails with older php versions.. |
| 842 | 842 | // $renderer->meta['geo']['geohash'] = (new Point($mainLon,$mainLat))->out('geohash'); |
| 843 | - $p = new Point ($mainLon, $mainLat); |
|
| 843 | + $p = new Point($mainLon, $mainLat); |
|
| 844 | 844 | $renderer->meta ['geo'] ['geohash'] = $p->out('geohash'); |
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - if(($this->getConf('enableA11y')) && (!empty ($_firstimage))) { |
|
| 848 | + if (($this->getConf('enableA11y')) && (!empty ($_firstimage))) { |
|
| 849 | 849 | // add map local image into relation/firstimage if not already filled and when it is a local image |
| 850 | 850 | |
| 851 | 851 | global $ID; |
| 852 | 852 | $rel = p_get_metadata($ID, 'relation', METADATA_RENDER_USING_CACHE); |
| 853 | 853 | // $img = $rel ['firstimage']; |
| 854 | - if(empty ($rel ['firstimage']) /* || $img == $_firstimage*/) { |
|
| 854 | + if (empty ($rel ['firstimage']) /* || $img == $_firstimage*/) { |
|
| 855 | 855 | //dbglog ( $_firstimage, |
| 856 | 856 | // 'olmap::render#rendering image relation metadata for _firstimage as $img was empty or same.' ); |
| 857 | 857 | // This seems to never work; the firstimage entry in the .meta file is empty |
@@ -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(); |
@@ -471,8 +471,9 @@ |
||
| 471 | 471 | * for better proxy handling... |
| 472 | 472 | */ |
| 473 | 473 | public function fetchTile(string $url) { |
| 474 | - if($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
| 475 | - return $cached; |
|
| 474 | + if($this->useTileCache && ($cached = $this->checkTileCache($url))) { |
|
| 475 | + return $cached; |
|
| 476 | + } |
|
| 476 | 477 | |
| 477 | 478 | $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')'; |
| 478 | 479 | if(function_exists("curl_init")) { |
@@ -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 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $this->height = $height; |
| 216 | 216 | // validate + set maptype |
| 217 | 217 | $this->maptype = $this->tileDefaultSrc; |
| 218 | - if(array_key_exists($maptype, $this->tileInfo)) { |
|
| 218 | + if (array_key_exists($maptype, $this->tileInfo)) { |
|
| 219 | 219 | $this->maptype = $maptype; |
| 220 | 220 | } |
| 221 | 221 | $this->markers = $markers; |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | $this->gpxFileName = $gpx; |
| 224 | 224 | $this->geojsonFileName = $geojson; |
| 225 | 225 | $this->mediaBaseDir = $mediaDir; |
| 226 | - $this->tileCacheBaseDir = $tileCacheBaseDir . '/olmaptiles'; |
|
| 226 | + $this->tileCacheBaseDir = $tileCacheBaseDir.'/olmaptiles'; |
|
| 227 | 227 | $this->useTileCache = $this->tileCacheBaseDir !== ''; |
| 228 | - $this->mapCacheBaseDir = $mediaDir . '/olmapmaps'; |
|
| 228 | + $this->mapCacheBaseDir = $mediaDir.'/olmapmaps'; |
|
| 229 | 229 | $this->autoZoomExtent = $autoZoomExtent; |
| 230 | 230 | $this->apikey = $apikey; |
| 231 | 231 | } |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function getMap(): string { |
| 239 | 239 | try { |
| 240 | - if($this->autoZoomExtent) { |
|
| 240 | + if ($this->autoZoomExtent) { |
|
| 241 | 241 | $this->autoZoom(); |
| 242 | 242 | } |
| 243 | - } catch(Exception $e) { |
|
| 243 | + } catch (Exception $e) { |
|
| 244 | 244 | dbglog($e); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // use map cache, so check cache for map |
| 248 | - if(!$this->checkMapCache()) { |
|
| 248 | + if (!$this->checkMapCache()) { |
|
| 249 | 249 | // map is not in cache, needs to be build |
| 250 | 250 | $this->makeMap(); |
| 251 | 251 | $this->mkdirRecursive(dirname($this->mapCacheIDToFilename()), 0777); |
@@ -265,37 +265,37 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | private function autoZoom(float $paddingFactor = 1.0): void { |
| 267 | 267 | $geoms = array(); |
| 268 | - $geoms [] = new Point ($this->lon, $this->lat); |
|
| 269 | - if(!empty ($this->markers)) { |
|
| 270 | - foreach($this->markers as $marker) { |
|
| 271 | - $geoms [] = new Point ($marker ['lon'], $marker ['lat']); |
|
| 268 | + $geoms [] = new Point($this->lon, $this->lat); |
|
| 269 | + if (!empty ($this->markers)) { |
|
| 270 | + foreach ($this->markers as $marker) { |
|
| 271 | + $geoms [] = new Point($marker ['lon'], $marker ['lat']); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | - if(file_exists($this->kmlFileName)) { |
|
| 274 | + if (file_exists($this->kmlFileName)) { |
|
| 275 | 275 | $g = geoPHP::load(file_get_contents($this->kmlFileName), 'kml'); |
| 276 | - if($g !== false) { |
|
| 276 | + if ($g !== false) { |
|
| 277 | 277 | $geoms [] = $g; |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - if(file_exists($this->gpxFileName)) { |
|
| 280 | + if (file_exists($this->gpxFileName)) { |
|
| 281 | 281 | $g = geoPHP::load(file_get_contents($this->gpxFileName), 'gpx'); |
| 282 | - if($g !== false) { |
|
| 282 | + if ($g !== false) { |
|
| 283 | 283 | $geoms [] = $g; |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | - if(file_exists($this->geojsonFileName)) { |
|
| 286 | + if (file_exists($this->geojsonFileName)) { |
|
| 287 | 287 | $g = geoPHP::load(file_get_contents($this->geojsonFileName), 'geojson'); |
| 288 | - if($g !== false) { |
|
| 288 | + if ($g !== false) { |
|
| 289 | 289 | $geoms [] = $g; |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if(count($geoms) <= 1) { |
|
| 293 | + if (count($geoms) <= 1) { |
|
| 294 | 294 | dbglog($geoms, "StaticMap::autoZoom: Skip setting autozoom options"); |
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - $geom = new GeometryCollection ($geoms); |
|
| 298 | + $geom = new GeometryCollection($geoms); |
|
| 299 | 299 | $centroid = $geom->centroid(); |
| 300 | 300 | $bbox = $geom->getBBox(); |
| 301 | 301 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $vy0 = log(tan(M_PI * (0.25 + $bbox ['miny'] / 360))); |
| 305 | 305 | $vy1 = log(tan(M_PI * (0.25 + $bbox ['maxy'] / 360))); |
| 306 | 306 | dbglog("StaticMap::autoZoom: vertical resolution: $vy0, $vy1"); |
| 307 | - if ($vy1 - $vy0 === 0.0){ |
|
| 307 | + if ($vy1 - $vy0 === 0.0) { |
|
| 308 | 308 | $resolutionVertical = 0; |
| 309 | 309 | dbglog("StaticMap::autoZoom: using $resolutionVertical"); |
| 310 | 310 | } else { |
@@ -316,11 +316,11 @@ discard block |
||
| 316 | 316 | dbglog("StaticMap::autoZoom: using $resolutionHorizontal"); |
| 317 | 317 | $resolution = max($resolutionHorizontal, $resolutionVertical) * $paddingFactor; |
| 318 | 318 | $zoom = $this->zoom; |
| 319 | - if ($resolution > 0){ |
|
| 319 | + if ($resolution > 0) { |
|
| 320 | 320 | $zoom = log(360 / ($resolution * $this->tileSize), 2); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if(is_finite($zoom) && $zoom < 15 && $zoom > 2) { |
|
| 323 | + if (is_finite($zoom) && $zoom < 15 && $zoom > 2) { |
|
| 324 | 324 | $this->zoom = floor($zoom); |
| 325 | 325 | } |
| 326 | 326 | $this->lon = $centroid->getX(); |
@@ -353,12 +353,12 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | public function mapCacheIDToFilename(): string { |
| 356 | - if(!$this->mapCacheFile) { |
|
| 357 | - $this->mapCacheFile = $this->mapCacheBaseDir . "/" . $this->maptype . "/" . $this->zoom . "/cache_" |
|
| 358 | - . substr($this->mapCacheID, 0, 2) . "/" . substr($this->mapCacheID, 2, 2) |
|
| 359 | - . "/" . substr($this->mapCacheID, 4); |
|
| 356 | + if (!$this->mapCacheFile) { |
|
| 357 | + $this->mapCacheFile = $this->mapCacheBaseDir."/".$this->maptype."/".$this->zoom."/cache_" |
|
| 358 | + . substr($this->mapCacheID, 0, 2)."/".substr($this->mapCacheID, 2, 2) |
|
| 359 | + . "/".substr($this->mapCacheID, 4); |
|
| 360 | 360 | } |
| 361 | - return $this->mapCacheFile . "." . $this->mapCacheExtension; |
|
| 361 | + return $this->mapCacheFile.".".$this->mapCacheExtension; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | public function makeMap(): void { |
| 368 | 368 | $this->initCoords(); |
| 369 | 369 | $this->createBaseMap(); |
| 370 | - if(!empty ($this->markers)) { |
|
| 370 | + if (!empty ($this->markers)) { |
|
| 371 | 371 | $this->placeMarkers(); |
| 372 | 372 | } |
| 373 | 373 | if (file_exists($this->kmlFileName)) { |
@@ -440,8 +440,8 @@ discard block |
||
| 440 | 440 | $this->offsetX += floor($startX - floor($this->centerX)) * $this->tileSize; |
| 441 | 441 | $this->offsetY += floor($startY - floor($this->centerY)) * $this->tileSize; |
| 442 | 442 | |
| 443 | - for($x = $startX; $x <= $endX; $x++) { |
|
| 444 | - for($y = $startY; $y <= $endY; $y++) { |
|
| 443 | + for ($x = $startX; $x <= $endX; $x++) { |
|
| 444 | + for ($y = $startY; $y <= $endY; $y++) { |
|
| 445 | 445 | $url = str_replace( |
| 446 | 446 | array( |
| 447 | 447 | '{Z}', |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | ); |
| 456 | 456 | |
| 457 | 457 | $tileData = $this->fetchTile($url); |
| 458 | - if($tileData) { |
|
| 458 | + if ($tileData) { |
|
| 459 | 459 | $tileImage = imagecreatefromstring($tileData); |
| 460 | 460 | } else { |
| 461 | 461 | $tileImage = imagecreate($this->tileSize, $this->tileSize); |
@@ -481,17 +481,17 @@ discard block |
||
| 481 | 481 | * for better proxy handling... |
| 482 | 482 | */ |
| 483 | 483 | public function fetchTile(string $url) { |
| 484 | - if($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
| 484 | + if ($this->useTileCache && ($cached = $this->checkTileCache($url))) |
|
| 485 | 485 | return $cached; |
| 486 | 486 | |
| 487 | - $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')'; |
|
| 488 | - if(function_exists("curl_init")) { |
|
| 487 | + $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; '.PHP_OS.')'; |
|
| 488 | + if (function_exists("curl_init")) { |
|
| 489 | 489 | // use cUrl |
| 490 | 490 | $ch = curl_init(); |
| 491 | 491 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 492 | 492 | curl_setopt($ch, CURLOPT_USERAGENT, $_UA); |
| 493 | 493 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); |
| 494 | - curl_setopt($ch, CURLOPT_URL, $url . $this->apikey); |
|
| 494 | + curl_setopt($ch, CURLOPT_URL, $url.$this->apikey); |
|
| 495 | 495 | dbglog("StaticMap::fetchTile: getting: $url using curl_exec"); |
| 496 | 496 | $tile = curl_exec($ch); |
| 497 | 497 | curl_close($ch); |
@@ -501,21 +501,21 @@ discard block |
||
| 501 | 501 | $opts = array( |
| 502 | 502 | 'http' => array( |
| 503 | 503 | 'method' => "GET", |
| 504 | - 'header' => "Accept-language: en\r\n" . "User-Agent: $_UA\r\n" . "accept: image/png\r\n", |
|
| 504 | + 'header' => "Accept-language: en\r\n"."User-Agent: $_UA\r\n"."accept: image/png\r\n", |
|
| 505 | 505 | 'request_fulluri' => true |
| 506 | 506 | ) |
| 507 | 507 | ); |
| 508 | - if(isset($conf['proxy']['host'], $conf['proxy']['port']) |
|
| 508 | + if (isset($conf['proxy']['host'], $conf['proxy']['port']) |
|
| 509 | 509 | && $conf['proxy']['host'] !== '' |
| 510 | 510 | && $conf['proxy']['port'] !== '') { |
| 511 | - $opts['http'] += ['proxy' => "tcp://" . $conf['proxy']['host'] . ":" . $conf['proxy']['port']]; |
|
| 511 | + $opts['http'] += ['proxy' => "tcp://".$conf['proxy']['host'].":".$conf['proxy']['port']]; |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | $context = stream_context_create($opts); |
| 515 | 515 | // dbglog("StaticMap::fetchTile: getting: $url . $this->apikey using file_get_contents and options $opts"); |
| 516 | - $tile = file_get_contents($url . $this->apikey, false, $context); |
|
| 516 | + $tile = file_get_contents($url.$this->apikey, false, $context); |
|
| 517 | 517 | } |
| 518 | - if($tile && $this->useTileCache) { |
|
| 518 | + if ($tile && $this->useTileCache) { |
|
| 519 | 519 | $this->writeTileToCache($url, $tile); |
| 520 | 520 | } |
| 521 | 521 | return $tile; |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | public function checkTileCache(string $url) { |
| 530 | 530 | $filename = $this->tileUrlToFilename($url); |
| 531 | - if(file_exists($filename)) { |
|
| 531 | + if (file_exists($filename)) { |
|
| 532 | 532 | return file_get_contents($filename); |
| 533 | 533 | } |
| 534 | 534 | return false; |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * @return string |
| 541 | 541 | */ |
| 542 | 542 | public function tileUrlToFilename(string $url): string { |
| 543 | - return $this->tileCacheBaseDir . "/" . substr($url, strpos($url, '/') + 1); |
|
| 543 | + return $this->tileCacheBaseDir."/".substr($url, strpos($url, '/') + 1); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | $count = 0; |
| 576 | 576 | $color = imagecolorallocate($this->image, 0, 0, 0); |
| 577 | 577 | $bgcolor = imagecolorallocate($this->image, 200, 200, 200); |
| 578 | - $markerBaseDir = __DIR__ . '/icons'; |
|
| 578 | + $markerBaseDir = __DIR__.'/icons'; |
|
| 579 | 579 | $markerImageOffsetX = 0; |
| 580 | 580 | $markerImageOffsetY = 0; |
| 581 | 581 | $markerShadowOffsetX = 0; |
| 582 | 582 | $markerShadowOffsetY = 0; |
| 583 | 583 | $markerShadowImg = null; |
| 584 | 584 | // loop thru marker array |
| 585 | - foreach($this->markers as $marker) { |
|
| 585 | + foreach ($this->markers as $marker) { |
|
| 586 | 586 | // set some local variables |
| 587 | 587 | $markerLat = $marker ['lat']; |
| 588 | 588 | $markerLon = $marker ['lon']; |
@@ -592,18 +592,18 @@ discard block |
||
| 592 | 592 | $markerShadow = ''; |
| 593 | 593 | $matches = false; |
| 594 | 594 | // check for marker type, get settings from markerPrototypes |
| 595 | - if($markerType) { |
|
| 596 | - foreach($this->markerPrototypes as $markerPrototype) { |
|
| 597 | - if(preg_match($markerPrototype ['regex'], $markerType, $matches)) { |
|
| 598 | - $markerFilename = $matches [0] . $markerPrototype ['extension']; |
|
| 599 | - if($markerPrototype ['offsetImage']) { |
|
| 595 | + if ($markerType) { |
|
| 596 | + foreach ($this->markerPrototypes as $markerPrototype) { |
|
| 597 | + if (preg_match($markerPrototype ['regex'], $markerType, $matches)) { |
|
| 598 | + $markerFilename = $matches [0].$markerPrototype ['extension']; |
|
| 599 | + if ($markerPrototype ['offsetImage']) { |
|
| 600 | 600 | list ($markerImageOffsetX, $markerImageOffsetY) = explode( |
| 601 | 601 | ",", |
| 602 | 602 | $markerPrototype ['offsetImage'] |
| 603 | 603 | ); |
| 604 | 604 | } |
| 605 | 605 | $markerShadow = $markerPrototype ['shadow']; |
| 606 | - if($markerShadow) { |
|
| 606 | + if ($markerShadow) { |
|
| 607 | 607 | list ($markerShadowOffsetX, $markerShadowOffsetY) = explode( |
| 608 | 608 | ",", |
| 609 | 609 | $markerPrototype ['offsetShadow'] |
@@ -613,14 +613,14 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | } |
| 615 | 615 | // create img resource |
| 616 | - if(file_exists($markerBaseDir . '/' . $markerFilename)) { |
|
| 617 | - $markerImg = imagecreatefrompng($markerBaseDir . '/' . $markerFilename); |
|
| 616 | + if (file_exists($markerBaseDir.'/'.$markerFilename)) { |
|
| 617 | + $markerImg = imagecreatefrompng($markerBaseDir.'/'.$markerFilename); |
|
| 618 | 618 | } else { |
| 619 | - $markerImg = imagecreatefrompng($markerBaseDir . '/marker.png'); |
|
| 619 | + $markerImg = imagecreatefrompng($markerBaseDir.'/marker.png'); |
|
| 620 | 620 | } |
| 621 | 621 | // check for shadow + create shadow recource |
| 622 | - if($markerShadow && file_exists($markerBaseDir . '/' . $markerShadow)) { |
|
| 623 | - $markerShadowImg = imagecreatefrompng($markerBaseDir . '/' . $markerShadow); |
|
| 622 | + if ($markerShadow && file_exists($markerBaseDir.'/'.$markerShadow)) { |
|
| 623 | + $markerShadowImg = imagecreatefrompng($markerBaseDir.'/'.$markerShadow); |
|
| 624 | 624 | } |
| 625 | 625 | // calc position |
| 626 | 626 | $destX = floor( |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | $this->tileSize * ($this->centerY - $this->latToTile($markerLat, $this->zoom)) |
| 633 | 633 | ); |
| 634 | 634 | // copy shadow on basemap |
| 635 | - if($markerShadow && $markerShadowImg) { |
|
| 635 | + if ($markerShadow && $markerShadowImg) { |
|
| 636 | 636 | imagecopy( |
| 637 | 637 | $this->image, |
| 638 | 638 | $markerShadowImg, |
@@ -694,14 +694,14 @@ discard block |
||
| 694 | 694 | * drawing colour |
| 695 | 695 | */ |
| 696 | 696 | private function drawGeometry(Geometry $geom, int $colour): void { |
| 697 | - if(empty($geom)) { |
|
| 697 | + if (empty($geom)) { |
|
| 698 | 698 | return; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - switch($geom->geometryType()) { |
|
| 701 | + switch ($geom->geometryType()) { |
|
| 702 | 702 | case 'GeometryCollection' : |
| 703 | 703 | // recursively draw part of the collection |
| 704 | - for($i = 1; $i < $geom->numGeometries() + 1; $i++) { |
|
| 704 | + for ($i = 1; $i < $geom->numGeometries() + 1; $i++) { |
|
| 705 | 705 | $_geom = $geom->geometryN($i); |
| 706 | 706 | $this->drawGeometry($_geom, $colour); |
| 707 | 707 | } |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | // extring is a linestring actually.. |
| 744 | 744 | $extRing = $polygon->exteriorRing(); |
| 745 | 745 | |
| 746 | - for($i = 1; $i < $extRing->numGeometries(); $i++) { |
|
| 746 | + for ($i = 1; $i < $extRing->numGeometries(); $i++) { |
|
| 747 | 747 | $p1 = $extRing->geometryN($i); |
| 748 | 748 | $x = floor( |
| 749 | 749 | ($this->width / 2) - $this->tileSize * ($this->centerX - $this->lonToTile($p1->x(), $this->zoom)) |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | */ |
| 770 | 770 | private function drawLineString($line, $colour) { |
| 771 | 771 | imagesetthickness($this->image, 2); |
| 772 | - for($p = 1; $p < $line->numGeometries(); $p++) { |
|
| 772 | + for ($p = 1; $p < $line->numGeometries(); $p++) { |
|
| 773 | 773 | // get first pair of points |
| 774 | 774 | $p1 = $line->geometryN($p); |
| 775 | 775 | $p2 = $line->geometryN($p + 1); |
@@ -842,8 +842,8 @@ discard block |
||
| 842 | 842 | * add copyright and origin notice and icons to the map. |
| 843 | 843 | */ |
| 844 | 844 | public function drawCopyright() { |
| 845 | - $logoBaseDir = dirname(__FILE__) . '/' . 'logo/'; |
|
| 846 | - $logoImg = imagecreatefrompng($logoBaseDir . $this->tileInfo ['openstreetmap'] ['logo']); |
|
| 845 | + $logoBaseDir = dirname(__FILE__).'/'.'logo/'; |
|
| 846 | + $logoImg = imagecreatefrompng($logoBaseDir.$this->tileInfo ['openstreetmap'] ['logo']); |
|
| 847 | 847 | $textcolor = imagecolorallocate($this->image, 0, 0, 0); |
| 848 | 848 | $bgcolor = imagecolorallocate($this->image, 200, 200, 200); |
| 849 | 849 | |
@@ -876,11 +876,11 @@ discard block |
||
| 876 | 876 | |
| 877 | 877 | // additional tile source info, ie. who created/hosted the tiles |
| 878 | 878 | $xIconOffset = 0; |
| 879 | - if($this->maptype === 'openstreetmap') { |
|
| 879 | + if ($this->maptype === 'openstreetmap') { |
|
| 880 | 880 | $mapAuthor = "(c) OpenStreetMap maps/CC BY-SA"; |
| 881 | 881 | } else { |
| 882 | 882 | $mapAuthor = $this->tileInfo [$this->maptype] ['txt']; |
| 883 | - $iconImg = imagecreatefrompng($logoBaseDir . $this->tileInfo [$this->maptype] ['logo']); |
|
| 883 | + $iconImg = imagecreatefrompng($logoBaseDir.$this->tileInfo [$this->maptype] ['logo']); |
|
| 884 | 884 | $xIconOffset = imagesx($iconImg); |
| 885 | 885 | imagecopy( |
| 886 | 886 | $this->image, |
@@ -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; |