Passed
Pull Request — master (#67)
by Mark
02:07
created
syntax/olmap.php 1 patch
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             // Google
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 .= "&center=" . $gmap ['lat'] . "," . $gmap ['lon'];
384
+        $imgUrl .= "&center=".$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
 block discarded – undo
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, -4);
505 505
                     $markers [] = array(
@@ -511,26 +511,26 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
      * @return string
596 596
      */
597 597
     private function getBing(array $gmap, array $overlay): string {
598
-        switch($gmap ['baselyr']) {
598
+        switch ($gmap ['baselyr']) {
599 599
             case 've hybrid' :
600 600
             case 'bing hybrid' :
601 601
                 $maptype = 'AerialWithLabels';
@@ -612,33 +612,33 @@  discard block
 block discarded – undo
612 612
                 $maptype = 'Road';
613 613
                 break;
614 614
         }
615
-        $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/" . $maptype;// . "/";
616
-        if($this->getConf('autoZoomMap')) {
615
+        $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/".$maptype; // . "/";
616
+        if ($this->getConf('autoZoomMap')) {
617 617
             $bbox = $this->calcBBOX($overlay, $gmap ['lat'], $gmap ['lon']);
618 618
             //$imgUrl .= "?ma=" . $bbox ['minlat'] . "," . $bbox ['minlon'] . ","
619 619
             //          . $bbox ['maxlat'] . "," . $bbox ['maxlon'];
620
-            $imgUrl .= "?ma=" . $bbox ['minlat'] . "%2C" . $bbox ['minlon'] . "%2C" . $bbox ['maxlat']
621
-                . "%2C" . $bbox ['maxlon'];
620
+            $imgUrl .= "?ma=".$bbox ['minlat']."%2C".$bbox ['minlon']."%2C".$bbox ['maxlat']
621
+                . "%2C".$bbox ['maxlon'];
622 622
             $imgUrl .= "&dcl=1";
623 623
         }
624
-        if(strpos($imgUrl, "?") === false)
624
+        if (strpos($imgUrl, "?") === false)
625 625
             $imgUrl .= "?";
626 626
 
627 627
         //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . ","
628 628
         //          . str_replace ( "px", "", $gmap ['height'] );
629
-        $imgUrl .= "&ms=" . str_replace("px", "", $gmap ['width']) . "%2C"
629
+        $imgUrl .= "&ms=".str_replace("px", "", $gmap ['width'])."%2C"
630 630
             . str_replace("px", "", $gmap ['height']);
631
-        $imgUrl .= "&key=" . $this->getConf('bingAPIKey');
632
-        if(!empty ($overlay)) {
631
+        $imgUrl .= "&key=".$this->getConf('bingAPIKey');
632
+        if (!empty ($overlay)) {
633 633
             $rowId = 0;
634
-            foreach($overlay as $data) {
634
+            foreach ($overlay as $data) {
635 635
                 list ($lat, $lon, $text, $angle, $opacity, $img) = $data;
636 636
                 // TODO icon style lookup, see: http://msdn.microsoft.com/en-us/library/ff701719.aspx for iconStyle
637 637
                 $iconStyle = 32;
638 638
                 $rowId++;
639 639
                 // NOTE: the max number of pushpins is 18! or we have to use POST
640 640
                 //  (http://msdn.microsoft.com/en-us/library/ff701724.aspx)
641
-                if($rowId == 18) {
641
+                if ($rowId == 18) {
642 642
                     break;
643 643
                 }
644 644
                 //$imgUrl .= "&pp=$lat,$lon;$iconStyle;$rowId";
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
         }
649 649
         global $conf;
650 650
         $imgUrl .= "&fmt=png";
651
-        $imgUrl .= "&c=" . $conf ['lang'];
651
+        $imgUrl .= "&c=".$conf ['lang'];
652 652
         return $imgUrl;
653 653
     }
654 654
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     private function calcBBOX(array $overlay, float $lat, float $lon): array {
667 667
         $lats = array($lat);
668 668
         $lons = array($lon);
669
-        foreach($overlay as $data) {
669
+        foreach ($overlay as $data) {
670 670
             list ($lat, $lon, $text, $angle, $opacity, $img) = $data;
671 671
             $lats [] = $lat;
672 672
             $lons [] = $lon;
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
      * @todo move this into a shared library
695 695
      */
696 696
     private function convertLat(float $decimaldegrees): string {
697
-        if(strpos($decimaldegrees, '-') !== false) {
697
+        if (strpos($decimaldegrees, '-') !== false) {
698 698
             $latPos = "S";
699 699
         } else {
700 700
             $latPos = "N";
701 701
         }
702 702
         $dms = $this->convertDDtoDMS(abs($decimaldegrees));
703
-        return hsc($dms . $latPos);
703
+        return hsc($dms.$latPos);
704 704
     }
705 705
 
706 706
     /**
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
         $secs = ($decimaldegrees - $dms) * 3600;
716 716
         $min  = floor($secs / 60);
717 717
         $sec  = round($secs - ($min * 60), 3);
718
-        $dms  .= 'º' . $min . '\'' . $sec . '"';
718
+        $dms .= 'º'.$min.'\''.$sec.'"';
719 719
         return $dms;
720 720
     }
721 721
 
@@ -727,13 +727,13 @@  discard block
 block discarded – undo
727 727
      * @todo move this into a shared library
728 728
      */
729 729
     private function convertLon(float $decimaldegrees): string {
730
-        if(strpos($decimaldegrees, '-') !== false) {
730
+        if (strpos($decimaldegrees, '-') !== false) {
731 731
             $lonPos = "W";
732 732
         } else {
733 733
             $lonPos = "E";
734 734
         }
735 735
         $dms = $this->convertDDtoDMS(abs($decimaldegrees));
736
-        return hsc($dms . $lonPos);
736
+        return hsc($dms.$lonPos);
737 737
     }
738 738
 
739 739
     /**
@@ -763,60 +763,60 @@  discard block
 block discarded – undo
763 763
 
764 764
         list ($mapid, $param, $mainLat, $mainLon, $poitable, $poitabledesc, $staticImgUrl, $_firstimage) = $data;
765 765
 
766
-        if($format === 'xhtml') {
766
+        if ($format === 'xhtml') {
767 767
             $olscript     = '';
768 768
             $stadiaEnable = $this->getConf('enableStadia');
769 769
             $osmEnable    = $this->getConf('enableOSM');
770 770
             $enableBing   = $this->getConf('enableBing');
771 771
 
772 772
             $scriptEnable = '';
773
-            if(!$initialised) {
773
+            if (!$initialised) {
774 774
                 $initialised = true;
775 775
                 // render necessary script tags only once
776
-                $olscript = '<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol/ol.js"></script>
777
-<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol/ol-layerswitcher.js"></script>';
776
+                $olscript = '<script defer="defer" src="'.DOKU_BASE.'lib/plugins/openlayersmap/ol/ol.js"></script>
777
+<script defer="defer" src="' . DOKU_BASE.'lib/plugins/openlayersmap/ol/ol-layerswitcher.js"></script>';
778 778
 
779 779
                 $scriptEnable = '<script defer="defer" src="data:text/javascript;base64,';
780 780
                 $scriptSrc    = $olscript ? 'const olEnable=true;' : 'const olEnable=false;';
781
-                $scriptSrc    .= 'const osmEnable=' . ($osmEnable ? 'true' : 'false') . ';';
782
-                $scriptSrc    .= 'const stadiaEnable=' . ($stadiaEnable ? 'true' : 'false') . ';';
783
-                $scriptSrc    .= 'const bEnable=' . ($enableBing ? 'true' : 'false') . ';';
784
-                $scriptSrc    .= 'const bApiKey="' . $this->getConf('bingAPIKey') . '";';
785
-                $scriptSrc    .= 'const tfApiKey="' . $this->getConf('tfApiKey') . '";';
786
-                $scriptSrc    .= 'const gApiKey="' . $this->getConf('googleAPIkey') . '";';
781
+                $scriptSrc    .= 'const osmEnable='.($osmEnable ? 'true' : 'false').';';
782
+                $scriptSrc    .= 'const stadiaEnable='.($stadiaEnable ? 'true' : 'false').';';
783
+                $scriptSrc    .= 'const bEnable='.($enableBing ? 'true' : 'false').';';
784
+                $scriptSrc    .= 'const bApiKey="'.$this->getConf('bingAPIKey').'";';
785
+                $scriptSrc    .= 'const tfApiKey="'.$this->getConf('tfApiKey').'";';
786
+                $scriptSrc    .= 'const gApiKey="'.$this->getConf('googleAPIkey').'";';
787 787
                 $scriptSrc    .= 'olMapData = []; let olMaps = {}; let olMapOverlays = {};';
788 788
                 $scriptEnable .= base64_encode($scriptSrc);
789 789
                 $scriptEnable .= '"></script>';
790 790
             }
791 791
             $renderer->doc .= "$olscript\n$scriptEnable";
792
-            $renderer->doc .= '<div class="olMapHelp">' . $this->locale_xhtml("help") . '</div>';
793
-            if($this->getConf('enableA11y')) {
794
-                $renderer->doc .= '<div id="' . $mapid . '-static" class="olStaticMap">'
795
-                    . p_render($format, p_get_instructions($staticImgUrl), $info) . '</div>';
792
+            $renderer->doc .= '<div class="olMapHelp">'.$this->locale_xhtml("help").'</div>';
793
+            if ($this->getConf('enableA11y')) {
794
+                $renderer->doc .= '<div id="'.$mapid.'-static" class="olStaticMap">'
795
+                    . p_render($format, p_get_instructions($staticImgUrl), $info).'</div>';
796 796
             }
797
-            $renderer->doc .= '<div id="' . $mapid . '-clearer" class="clearer"><p>&nbsp;</p></div>';
798
-            if($this->getConf('enableA11y')) {
797
+            $renderer->doc .= '<div id="'.$mapid.'-clearer" class="clearer"><p>&nbsp;</p></div>';
798
+            if ($this->getConf('enableA11y')) {
799 799
                 // render a table of the POI for the print and a11y presentation, it is hidden using javascript
800 800
                 $renderer->doc .= '
801
-                <div id="' . $mapid . '-table-span" class="olPOItableSpan">
802
-                    <table id="' . $mapid . '-table" class="olPOItable">
803
-                    <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle') . '</caption>
801
+                <div id="' . $mapid.'-table-span" class="olPOItableSpan">
802
+                    <table id="' . $mapid.'-table" class="olPOItable">
803
+                    <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle').'</caption>
804 804
                     <thead class="olPOITblHeader">
805 805
                     <tr>
806 806
                     <th class="rowId" scope="col">id</th>
807
-                    <th class="icon" scope="col">' . $this->getLang('olmapPOIicon') . '</th>
808
-                    <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle') . '">'
809
-                    . $this->getLang('olmapPOIlat') . '</th>
810
-                    <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle') . '">'
811
-                    . $this->getLang('olmapPOIlon') . '</th>
812
-                    <th class="txt" scope="col">' . $this->getLang('olmapPOItxt') . '</th>
807
+                    <th class="icon" scope="col">' . $this->getLang('olmapPOIicon').'</th>
808
+                    <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle').'">'
809
+                    . $this->getLang('olmapPOIlat').'</th>
810
+                    <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle').'">'
811
+                    . $this->getLang('olmapPOIlon').'</th>
812
+                    <th class="txt" scope="col">' . $this->getLang('olmapPOItxt').'</th>
813 813
                     </tr>
814 814
                     </thead>';
815
-                if($poitabledesc != '') {
816
-                    $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">' . $poitabledesc
815
+                if ($poitabledesc != '') {
816
+                    $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">'.$poitabledesc
817 817
                         . '</td></tr></tfoot>';
818 818
                 }
819
-                $renderer->doc .= '<tbody class="olPOITblBody">' . $poitable . '</tbody>
819
+                $renderer->doc .= '<tbody class="olPOITblBody">'.$poitable.'</tbody>
820 820
                     </table>
821 821
                 </div>';
822 822
                 $renderer->doc .= "\n";
@@ -827,28 +827,28 @@  discard block
 block discarded – undo
827 827
             $renderer->doc .= '"></script>';
828 828
             $mapnumber++;
829 829
             return true;
830
-        } elseif($format === 'metadata') {
831
-            if(!(($this->dflt ['lat'] == $mainLat) && ($this->dflt ['lon'] == $mainLon))) {
830
+        } elseif ($format === 'metadata') {
831
+            if (!(($this->dflt ['lat'] == $mainLat) && ($this->dflt ['lon'] == $mainLon))) {
832 832
                 // render geo metadata, unless they are the default
833 833
                 $renderer->meta ['geo'] ['lat'] = $mainLat;
834 834
                 $renderer->meta ['geo'] ['lon'] = $mainLon;
835
-                if($geophp = plugin_load('helper', 'geophp')) {
835
+                if ($geophp = plugin_load('helper', 'geophp')) {
836 836
                     // if we have the geoPHP helper, add the geohash
837 837
 
838 838
                     // fails with older php versions..
839 839
                     // $renderer->meta['geo']['geohash'] = (new Point($mainLon,$mainLat))->out('geohash');
840
-                    $p                                  = new Point ($mainLon, $mainLat);
840
+                    $p                                  = new Point($mainLon, $mainLat);
841 841
                     $renderer->meta ['geo'] ['geohash'] = $p->out('geohash');
842 842
                 }
843 843
             }
844 844
 
845
-            if(($this->getConf('enableA11y')) && (!empty ($_firstimage))) {
845
+            if (($this->getConf('enableA11y')) && (!empty ($_firstimage))) {
846 846
                 // add map local image into relation/firstimage if not already filled and when it is a local image
847 847
 
848 848
                 global $ID;
849 849
                 $rel = p_get_metadata($ID, 'relation', METADATA_RENDER_USING_CACHE);
850 850
                 // $img = $rel ['firstimage'];
851
-                if(empty ($rel ['firstimage']) /* || $img == $_firstimage*/) {
851
+                if (empty ($rel ['firstimage']) /* || $img == $_firstimage*/) {
852 852
                     //dbglog ( $_firstimage,
853 853
                     // 'olmap::render#rendering image relation metadata for _firstimage as $img was empty or same.' );
854 854
                     // This seems to never work; the firstimage entry in the .meta file is empty
Please login to merge, or discard this patch.