Passed
Pull Request — master (#8)
by Mark
02:40
created
helper/staticmap.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
         }
98 98
         // normalize WxH
99 99
         list($width, $height) = explode('x', $size);
100
-        $width = (int)$width;
100
+        $width = (int) $width;
101 101
         if ($width > $this->maxWidth) {
102 102
             $width = $this->maxWidth;
103 103
         }
104
-        $height = (int)$height;
104
+        $height = (int) $height;
105 105
         if ($height > $this->maxHeight) {
106 106
             $height = $this->maxHeight;
107 107
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $geojson = $this->mediaIdToPath($geojson);
115 115
 
116 116
         // create map
117
-        require_once DOKU_PLUGIN . 'openlayersmap/StaticMap.php';
117
+        require_once DOKU_PLUGIN.'openlayersmap/StaticMap.php';
118 118
         $map = new StaticMap(
119 119
             $lat, $lon, $zoom, $width, $height, $maptype,
120 120
             $markers, $gpx, $kml, $geojson, $conf['mediadir'], $conf['cachedir'],
@@ -146,6 +146,6 @@  discard block
 block discarded – undo
146 146
             $id = substr($id, 1);
147 147
         }
148 148
         $id = str_replace(":", "/", $id);
149
-        return $conf['mediadir'] . '/' . $id;
149
+        return $conf['mediadir'].'/'.$id;
150 150
     }
151 151
 }
Please login to merge, or discard this patch.
admin/purge.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function getMenuIcon(): string
40 40
     {
41 41
         $plugin = $this->getPluginName();
42
-        return DOKU_PLUGIN . $plugin . '/admin/purge.svg';
42
+        return DOKU_PLUGIN.$plugin.'/admin/purge.svg';
43 43
     }
44 44
 
45 45
     /**
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
             return;
54 54
         }
55 55
         if (isset($_REQUEST['purgetiles'])) {
56
-            $path = $conf['cachedir'] . '/olmaptiles';
56
+            $path = $conf['cachedir'].'/olmaptiles';
57 57
             if ($this->rrmdir($path)) {
58 58
                 msg($this->getLang('admin_purged_tiles'));
59 59
             }
60 60
         }
61 61
         if (isset($_REQUEST['purgemaps'])) {
62
-            $path = $conf['mediadir'] . '/olmapmaps';
62
+            $path = $conf['mediadir'].'/olmapmaps';
63 63
             if ($this->rrmdir($path)) {
64 64
                 msg($this->getLang('admin_purged_maps'));
65 65
             }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />'
107 107
         );
108 108
         $form->addElement(
109
-            '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles')
109
+            '<label for="purgetiles" class="label">'.$this->getLang('admin_purge_tiles')
110 110
             . '</label>'
111 111
         );
112 112
         $form->addElement('</p>');
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $form->addElement('<p>');
117 117
         $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />');
118 118
         $form->addElement(
119
-            '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>'
119
+            '<label for="purgemaps" class="label">'.$this->getLang('admin_purge_maps').'</label>'
120 120
         );
121 121
         $form->addElement('</p>');
122 122
         $form->endFieldset();
Please login to merge, or discard this patch.
action.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     public function insertButton(Doku_Event $event, $param)
44 44
     {
45
-        $strOpen       = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" ';
45
+        $strOpen = '<olmap id="olMapOne" width="550px" height="450px" lat="50.0" ';
46 46
         $strOpen       .= 'lon="5.1" zoom="12" statusbar="1" controls="1" poihoverstyle="0" ';
47 47
         $strOpen       .= 'baselyr="OpenStreetMap" gpxfile="" kmlfile="" geojsonfile="" summary="" >\n';
48 48
         $strOpen       .= '~~ Plugin olmap help.\n';
Please login to merge, or discard this patch.
_test/general.test.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      */
33 33
     final public function test_plugininfo(): void
34 34
     {
35
-        $file = __DIR__ . '/../plugin.info.txt';
35
+        $file = __DIR__.'/../plugin.info.txt';
36 36
         self::assertFileExists($file);
37 37
 
38 38
         $info = confToHash($file);
Please login to merge, or discard this patch.
syntax/olmap.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
             if (!$this->getConf('bingAPIKey')) {
127 127
                 // in case there is no Bing api key we'll use OSM
128 128
                 $_firstimageID = $this->getStaticOSM($gmap, $overlay);
129
-                $imgUrl        .= $_firstimageID;
129
+                $imgUrl .= $_firstimageID;
130 130
                 if ($this->getConf('optionStaticMapGenerator') == 'remote') {
131 131
                     $imgUrl .= "&.png";
132 132
                 }
133 133
             } else {
134 134
                 // seems that Bing doesn't like the DW client, turn off caching
135 135
                 $_nocache = true;
136
-                $imgUrl   .= $this->getBing($gmap, $overlay) . "&.png";
136
+                $imgUrl .= $this->getBing($gmap, $overlay)."&.png";
137 137
             }
138 138
         } /* elseif (stripos ( $gmap ['baselyr'], 'mapquest' ) !== false) {
139 139
             // MapQuest
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
         } */ else {
152 152
             // default OSM
153 153
             $_firstimageID = $this->getStaticOSM($gmap, $overlay);
154
-            $imgUrl        .= $_firstimageID;
154
+            $imgUrl .= $_firstimageID;
155 155
             if ($this->getConf('optionStaticMapGenerator') == 'remote') {
156 156
                 $imgUrl .= "&.png";
157 157
             }
158 158
         }
159 159
 
160 160
         // append dw p_render specific params and render
161
-        $imgUrl .= "?" . str_replace("px", "", $gmap ['width']) . "x"
161
+        $imgUrl .= "?".str_replace("px", "", $gmap ['width'])."x"
162 162
             . str_replace("px", "", $gmap ['height']);
163 163
         $imgUrl .= "&nolink";
164 164
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $imgUrl .= "&nocache";
168 168
         }
169 169
 
170
-        $imgUrl .= " |" . $gmap ['summary'] . " }}";
170
+        $imgUrl .= " |".$gmap ['summary']." }}";
171 171
 
172 172
         // Logger::debug("complete image tags is:",$imgUrl);
173 173
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         // create a javascript parameter string for the map
176 176
         $param = '';
177 177
         foreach ($gmap as $key => $val) {
178
-            $param .= is_numeric($val) ? "$key: $val, " : "$key: '" . hsc($val) . "', ";
178
+            $param .= is_numeric($val) ? "$key: $val, " : "$key: '".hsc($val)."', ";
179 179
         }
180 180
         if (!empty ($param)) {
181 181
             $param = substr($param, 0, -2);
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 
203 203
                 $poitable .= '
204 204
                     <tr>
205
-                    <td class="rowId">' . $rowId . '</td>
206
-                    <td class="icon"><img src="' . DOKU_BASE . 'lib/plugins/openlayersmap/icons/' . $img . '" alt="'
207
-                    . substr($img, 0, -4) . $this->getlang('alt_legend_poi') . '" /></td>
208
-                    <td class="lat" title="' . $this->getLang('olmapPOIlatTitle') . '">' . $lat . '</td>
209
-                    <td class="lon" title="' . $this->getLang('olmapPOIlonTitle') . '">' . $lon . '</td>
210
-                    <td class="txt">' . $text . '</td>
205
+                    <td class="rowId">' . $rowId.'</td>
206
+                    <td class="icon"><img src="' . DOKU_BASE.'lib/plugins/openlayersmap/icons/'.$img.'" alt="'
207
+                    . substr($img, 0, -4).$this->getlang('alt_legend_poi').'" /></td>
208
+                    <td class="lat" title="' . $this->getLang('olmapPOIlatTitle').'">'.$lat.'</td>
209
+                    <td class="lon" title="' . $this->getLang('olmapPOIlonTitle').'">'.$lon.'</td>
210
+                    <td class="txt">' . $text.'</td>
211 211
                     </tr>';
212 212
             }
213 213
             $poi = substr($poi, 2);
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
                     <tr>
218 218
                     <td class="rowId"><img src="' . DOKU_BASE
219 219
                 . 'lib/plugins/openlayersmap/toolbar/kml_file.png" alt="KML file" /></td>
220
-                    <td class="icon"><img src="' . DOKU_BASE . 'lib/plugins/openlayersmap/toolbar/kml_line.png" alt="'
221
-                . $this->getlang('alt_legend_kml') . '" /></td>
222
-                    <td class="txt" colspan="3">KML track: ' . $this->getFileName($gmap ['kmlfile']) . '</td>
220
+                    <td class="icon"><img src="' . DOKU_BASE.'lib/plugins/openlayersmap/toolbar/kml_line.png" alt="'
221
+                . $this->getlang('alt_legend_kml').'" /></td>
222
+                    <td class="txt" colspan="3">KML track: ' . $this->getFileName($gmap ['kmlfile']).'</td>
223 223
                     </tr>';
224 224
         }
225 225
         if (!empty ($gmap ['gpxfile'])) {
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
                 . 'lib/plugins/openlayersmap/toolbar/gpx_file.png" alt="GPX file" /></td>
230 230
                     <td class="icon"><img src="' . DOKU_BASE
231 231
                 . 'lib/plugins/openlayersmap/toolbar/gpx_line.png" alt="'
232
-                . $this->getlang('alt_legend_gpx') . '" /></td>
233
-                    <td class="txt" colspan="3">GPX track: ' . $this->getFileName($gmap ['gpxfile']) . '</td>
232
+                . $this->getlang('alt_legend_gpx').'" /></td>
233
+                    <td class="txt" colspan="3">GPX track: ' . $this->getFileName($gmap ['gpxfile']).'</td>
234 234
                     </tr>';
235 235
         }
236 236
         if (!empty ($gmap ['geojsonfile'])) {
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
                 . 'lib/plugins/openlayersmap/toolbar/geojson_file.png" alt="GeoJSON file" /></td>
241 241
                     <td class="icon"><img src="' . DOKU_BASE
242 242
                 . 'lib/plugins/openlayersmap/toolbar/geojson_line.png" alt="'
243
-                . $this->getlang('alt_legend_geojson') . '" /></td>
244
-                    <td class="txt" colspan="3">GeoJSON track: ' . $this->getFileName($gmap ['geojsonfile']) . '</td>
243
+                . $this->getlang('alt_legend_geojson').'" /></td>
244
+                    <td class="txt" colspan="3">GeoJSON track: ' . $this->getFileName($gmap ['geojsonfile']).'</td>
245 245
                     </tr>';
246 246
         }
247 247
 
248 248
         $autozoom = empty ($gmap ['autozoom']) ? $this->getConf('autoZoomMap') : $gmap ['autozoom'];
249
-        $js       = "{mapOpts: {" . $param . ", displayformat: '" . $this->getConf('displayformat')
250
-            . "', autozoom: " . $autozoom . "}, poi: [$poi]};";
249
+        $js       = "{mapOpts: {".$param.", displayformat: '".$this->getConf('displayformat')
250
+            . "', autozoom: ".$autozoom."}, poi: [$poi]};";
251 251
         // unescape the json
252 252
         $poitable = stripslashes($poitable);
253 253
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         // parse match for instructions, break into key value pairs
278 278
         $gmap = $this->dflt;
279 279
         foreach ($gmap as $key => &$value) {
280
-            $defval = $this->getConf('default_' . $key);
280
+            $defval = $this->getConf('default_'.$key);
281 281
             if ($defval !== '') {
282 282
                 $value = $defval;
283 283
             }
@@ -387,29 +387,29 @@  discard block
 block discarded – undo
387 387
         // see: https://developers.google.com/maps/documentation/staticmaps/index#Viewports
388 388
         // 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
389 389
         $imgUrl = "https://maps.googleapis.com/maps/api/staticmap?";
390
-        $imgUrl .= "&size=" . str_replace("px", "", $gmap ['width']) . "x"
390
+        $imgUrl .= "&size=".str_replace("px", "", $gmap ['width'])."x"
391 391
             . str_replace("px", "", $gmap ['height']);
392 392
         //if (!$this->getConf( 'autoZoomMap')) { // no need for center & zoom params }
393
-        $imgUrl .= "&center=" . $gmap ['lat'] . "," . $gmap ['lon'];
393
+        $imgUrl .= "&center=".$gmap ['lat'].",".$gmap ['lon'];
394 394
         // max is 21 (== building scale), but that's overkill..
395 395
         if ($gmap ['zoom'] > 17) {
396 396
             $imgUrl .= "&zoom=17";
397 397
         } else {
398
-            $imgUrl .= "&zoom=" . $gmap ['zoom'];
398
+            $imgUrl .= "&zoom=".$gmap ['zoom'];
399 399
         }
400 400
         if (!empty ($overlay)) {
401 401
             $rowId = 0;
402 402
             foreach ($overlay as $data) {
403 403
                 list ($lat, $lon, $text, $angle, $opacity, $img) = $data;
404
-                $imgUrl .= "&markers=icon%3a" . $sUrl . "lib/plugins/openlayersmap/icons/" . $img . "%7c"
405
-                    . $lat . "," . $lon . "%7clabel%3a" . ++$rowId;
404
+                $imgUrl .= "&markers=icon%3a".$sUrl."lib/plugins/openlayersmap/icons/".$img."%7c"
405
+                    . $lat.",".$lon."%7clabel%3a".++$rowId;
406 406
             }
407 407
         }
408
-        $imgUrl .= "&format=png&maptype=" . $maptype;
408
+        $imgUrl .= "&format=png&maptype=".$maptype;
409 409
         global $conf;
410
-        $imgUrl .= "&language=" . $conf ['lang'];
410
+        $imgUrl .= "&language=".$conf ['lang'];
411 411
         if ($this->getConf('googleAPIkey')) {
412
-            $imgUrl .= "&key=" . $this->getConf('googleAPIkey');
412
+            $imgUrl .= "&key=".$this->getConf('googleAPIkey');
413 413
         }
414 414
         // Logger::debug('syntax_plugin_openlayersmap_olmap::getGoogle: Google image url is:',$imgUrl);
415 415
         return $imgUrl;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             if (!$geophp = plugin_load('helper', 'geophp')) {
503 503
                 Logger::debug('geophp plugin is not available for use.', $geophp);
504 504
             }
505
-            $size = str_replace("px", "", $gmap ['width']) . "x"
505
+            $size = str_replace("px", "", $gmap ['width'])."x"
506 506
                 . str_replace("px", "", $gmap ['height']);
507 507
 
508 508
             $markers = array();
@@ -526,19 +526,19 @@  discard block
 block discarded – undo
526 526
                     break;
527 527
                 case 'transport' :
528 528
                     $maptype = 'transport';
529
-                    $apikey  = '?apikey=' . $this->getConf('tfApiKey');
529
+                    $apikey  = '?apikey='.$this->getConf('tfApiKey');
530 530
                     break;
531 531
                 case 'landscape' :
532 532
                     $maptype = 'landscape';
533
-                    $apikey  = '?apikey=' . $this->getConf('tfApiKey');
533
+                    $apikey  = '?apikey='.$this->getConf('tfApiKey');
534 534
                     break;
535 535
                 case 'outdoors' :
536 536
                     $maptype = 'outdoors';
537
-                    $apikey  = '?apikey=' . $this->getConf('tfApiKey');
537
+                    $apikey  = '?apikey='.$this->getConf('tfApiKey');
538 538
                     break;
539 539
                 case 'cycle map' :
540 540
                     $maptype = 'cycle';
541
-                    $apikey  = '?apikey=' . $this->getConf('tfApiKey');
541
+                    $apikey  = '?apikey='.$this->getConf('tfApiKey');
542 542
                     break;
543 543
                 case 'hike and bike map' :
544 544
                     $maptype = 'hikeandbike';
@@ -575,25 +575,25 @@  discard block
 block discarded – undo
575 575
             //  ol-marker|47.921629720114,18.027343747285,ol-marker-gold|47.951071133739,19.257812497236,
576 576
             //  ol-marker-blue|47.180141361692,19.257812497236,ol-marker-green
577 577
             $imgUrl = "https://staticmap.openstreetmap.de/staticmap.php";
578
-            $imgUrl .= "?center=" . $gmap ['lat'] . "," . $gmap ['lon'];
579
-            $imgUrl .= "&size=" . str_replace("px", "", $gmap ['width']) . "x"
578
+            $imgUrl .= "?center=".$gmap ['lat'].",".$gmap ['lon'];
579
+            $imgUrl .= "&size=".str_replace("px", "", $gmap ['width'])."x"
580 580
                 . str_replace("px", "", $gmap ['height']);
581 581
 
582 582
             if ($gmap ['zoom'] > 16) {
583 583
                 // actually this could even be 18, but that seems overkill
584 584
                 $imgUrl .= "&zoom=16";
585 585
             } else {
586
-                $imgUrl .= "&zoom=" . $gmap ['zoom'];
586
+                $imgUrl .= "&zoom=".$gmap ['zoom'];
587 587
             }
588 588
 
589 589
             if (!empty ($overlay)) {
590
-                $rowId  = 0;
590
+                $rowId = 0;
591 591
                 $imgUrl .= "&markers=";
592 592
                 foreach ($overlay as $data) {
593 593
                     list ($lat, $lon, $text, $angle, $opacity, $img) = $data;
594 594
                     $rowId++;
595 595
                     $iconStyle = "lightblue$rowId";
596
-                    $imgUrl    .= "$lat,$lon,$iconStyle%7c";
596
+                    $imgUrl .= "$lat,$lon,$iconStyle%7c";
597 597
                 }
598 598
                 $imgUrl = substr($imgUrl, 0, -3);
599 599
             }
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
                 $maptype = 'Road';
631 631
                 break;
632 632
         }
633
-        $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/" . $maptype;// . "/";
633
+        $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/".$maptype; // . "/";
634 634
         if ($this->getConf('autoZoomMap')) {
635 635
             $bbox = $this->calcBBOX($overlay, $gmap ['lat'], $gmap ['lon']);
636 636
             //$imgUrl .= "?ma=" . $bbox ['minlat'] . "," . $bbox ['minlon'] . ","
637 637
             //          . $bbox ['maxlat'] . "," . $bbox ['maxlon'];
638
-            $imgUrl .= "?ma=" . $bbox ['minlat'] . "%2C" . $bbox ['minlon'] . "%2C" . $bbox ['maxlat']
639
-                . "%2C" . $bbox ['maxlon'];
638
+            $imgUrl .= "?ma=".$bbox ['minlat']."%2C".$bbox ['minlon']."%2C".$bbox ['maxlat']
639
+                . "%2C".$bbox ['maxlon'];
640 640
             $imgUrl .= "&dcl=1";
641 641
         }
642 642
         if (strpos($imgUrl, "?") === false) {
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 
646 646
         //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . ","
647 647
         //          . str_replace ( "px", "", $gmap ['height'] );
648
-        $imgUrl .= "&ms=" . str_replace("px", "", $gmap ['width']) . "%2C"
648
+        $imgUrl .= "&ms=".str_replace("px", "", $gmap ['width'])."%2C"
649 649
             . str_replace("px", "", $gmap ['height']);
650
-        $imgUrl .= "&key=" . $this->getConf('bingAPIKey');
650
+        $imgUrl .= "&key=".$this->getConf('bingAPIKey');
651 651
         if (!empty ($overlay)) {
652 652
             $rowId = 0;
653 653
             foreach ($overlay as $data) {
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
         }
667 667
         global $conf;
668 668
         $imgUrl .= "&fmt=png";
669
-        $imgUrl .= "&c=" . $conf ['lang'];
669
+        $imgUrl .= "&c=".$conf ['lang'];
670 670
         // Logger::debug('syntax_plugin_openlayersmap_olmap::getBing: bing image url is:',$imgUrl);
671 671
         return $imgUrl;
672 672
     }
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
             $latPos = "N";
722 722
         }
723 723
         $dms = $this->convertDDtoDMS(abs($decimaldegrees));
724
-        return hsc($dms . $latPos);
724
+        return hsc($dms.$latPos);
725 725
     }
726 726
 
727 727
     /**
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         $secs = ($decimaldegrees - $dms) * 3600;
738 738
         $min  = floor($secs / 60);
739 739
         $sec  = round($secs - ($min * 60), 3);
740
-        $dms  .= 'º' . $min . '\'' . $sec . '"';
740
+        $dms .= 'º'.$min.'\''.$sec.'"';
741 741
         return $dms;
742 742
     }
743 743
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
             $lonPos = "E";
757 757
         }
758 758
         $dms = $this->convertDDtoDMS(abs($decimaldegrees));
759
-        return hsc($dms . $lonPos);
759
+        return hsc($dms.$lonPos);
760 760
     }
761 761
 
762 762
     /**
@@ -799,50 +799,50 @@  discard block
 block discarded – undo
799 799
             if (!$initialised) {
800 800
                 $initialised = true;
801 801
                 // render necessary script tags only once
802
-                $olscript = '<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol6/ol.js"></script>
803
-<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol6/ol-layerswitcher.js"></script>';
802
+                $olscript = '<script defer="defer" src="'.DOKU_BASE.'lib/plugins/openlayersmap/ol6/ol.js"></script>
803
+<script defer="defer" src="' . DOKU_BASE.'lib/plugins/openlayersmap/ol6/ol-layerswitcher.js"></script>';
804 804
 
805 805
                 $scriptEnable = '<script defer="defer" src="data:text/javascript;base64,';
806 806
                 $scriptSrc    = $olscript ? 'const olEnable=true;' : 'const olEnable=false;';
807
-                $scriptSrc    .= 'const osmEnable=' . ($osmEnable ? 'true' : 'false') . ';';
808
-                $scriptSrc    .= 'const stamenEnable=' . ($stamenEnable ? 'true' : 'false') . ';';
809
-                $scriptSrc    .= 'const bEnable=' . ($enableBing ? 'true' : 'false') . ';';
810
-                $scriptSrc    .= 'const bApiKey="' . $this->getConf('bingAPIKey') . '";';
811
-                $scriptSrc    .= 'const tfApiKey="' . $this->getConf('tfApiKey') . '";';
812
-                $scriptSrc    .= 'const gApiKey="' . $this->getConf('googleAPIkey') . '";';
807
+                $scriptSrc    .= 'const osmEnable='.($osmEnable ? 'true' : 'false').';';
808
+                $scriptSrc    .= 'const stamenEnable='.($stamenEnable ? 'true' : 'false').';';
809
+                $scriptSrc    .= 'const bEnable='.($enableBing ? 'true' : 'false').';';
810
+                $scriptSrc    .= 'const bApiKey="'.$this->getConf('bingAPIKey').'";';
811
+                $scriptSrc    .= 'const tfApiKey="'.$this->getConf('tfApiKey').'";';
812
+                $scriptSrc    .= 'const gApiKey="'.$this->getConf('googleAPIkey').'";';
813 813
                 $scriptSrc    .= 'olMapData = []; let olMaps = {}; let olMapOverlays = {};';
814 814
                 $scriptEnable .= base64_encode($scriptSrc);
815 815
                 $scriptEnable .= '"></script>';
816 816
             }
817 817
             $renderer->doc .= "$olscript\n$scriptEnable";
818
-            $renderer->doc .= '<div class="olMapHelp">' . $this->locale_xhtml("help") . '</div>';
818
+            $renderer->doc .= '<div class="olMapHelp">'.$this->locale_xhtml("help").'</div>';
819 819
             if ($this->getConf('enableA11y')) {
820
-                $renderer->doc .= '<div id="' . $mapid . '-static" class="olStaticMap">'
821
-                    . p_render($format, p_get_instructions($staticImgUrl), $info) . '</div>';
820
+                $renderer->doc .= '<div id="'.$mapid.'-static" class="olStaticMap">'
821
+                    . p_render($format, p_get_instructions($staticImgUrl), $info).'</div>';
822 822
             }
823
-            $renderer->doc .= '<div id="' . $mapid . '-clearer" class="clearer"><p>&nbsp;</p></div>';
823
+            $renderer->doc .= '<div id="'.$mapid.'-clearer" class="clearer"><p>&nbsp;</p></div>';
824 824
             if ($this->getConf('enableA11y')) {
825 825
                 // render a table of the POI for the print and a11y presentation, it is hidden using javascript
826 826
                 $renderer->doc .= '
827
-                <div class="olPOItableSpan" id="' . $mapid . '-table-span">
828
-                    <table class="olPOItable" id="' . $mapid . '-table">
829
-                    <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle') . '</caption>
827
+                <div class="olPOItableSpan" id="' . $mapid.'-table-span">
828
+                    <table class="olPOItable" id="' . $mapid.'-table">
829
+                    <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle').'</caption>
830 830
                     <thead class="olPOITblHeader">
831 831
                     <tr>
832 832
                     <th class="rowId" scope="col">id</th>
833
-                    <th class="icon" scope="col">' . $this->getLang('olmapPOIicon') . '</th>
834
-                    <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle') . '">'
835
-                    . $this->getLang('olmapPOIlat') . '</th>
836
-                    <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle') . '">'
837
-                    . $this->getLang('olmapPOIlon') . '</th>
838
-                    <th class="txt" scope="col">' . $this->getLang('olmapPOItxt') . '</th>
833
+                    <th class="icon" scope="col">' . $this->getLang('olmapPOIicon').'</th>
834
+                    <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle').'">'
835
+                    . $this->getLang('olmapPOIlat').'</th>
836
+                    <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle').'">'
837
+                    . $this->getLang('olmapPOIlon').'</th>
838
+                    <th class="txt" scope="col">' . $this->getLang('olmapPOItxt').'</th>
839 839
                     </tr>
840 840
                     </thead>';
841 841
                 if ($poitabledesc != '') {
842
-                    $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">' . $poitabledesc
842
+                    $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">'.$poitabledesc
843 843
                         . '</td></tr></tfoot>';
844 844
                 }
845
-                $renderer->doc .= '<tbody class="olPOITblBody">' . $poitable . '</tbody>
845
+                $renderer->doc .= '<tbody class="olPOITblBody">'.$poitable.'</tbody>
846 846
                     </table>
847 847
                 </div>';
848 848
                 $renderer->doc .= "\n";
Please login to merge, or discard this patch.
StaticMap.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 // phpcs:disable PSR1.Files.SideEffects
25 25
 // TODO resolve side effect
26
-include_once(realpath(__DIR__) . '/../geophp/geoPHP/geoPHP.inc');
26
+include_once(realpath(__DIR__).'/../geophp/geoPHP/geoPHP.inc');
27 27
 
28 28
 /**
29 29
  *
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
         $this->gpxFileName      = $gpx;
217 217
         $this->geojsonFileName  = $geojson;
218 218
         $this->mediaBaseDir     = $mediaDir;
219
-        $this->tileCacheBaseDir = $tileCacheBaseDir . '/olmaptiles';
219
+        $this->tileCacheBaseDir = $tileCacheBaseDir.'/olmaptiles';
220 220
         $this->useTileCache     = $this->tileCacheBaseDir !== '';
221
-        $this->mapCacheBaseDir  = $mediaDir . '/olmapmaps';
221
+        $this->mapCacheBaseDir  = $mediaDir.'/olmapmaps';
222 222
         $this->autoZoomExtent   = $autoZoomExtent;
223 223
         $this->apikey           = $apikey;
224 224
     }
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
     private function autoZoom(float $paddingFactor = 1.0): void
264 264
     {
265 265
         $geoms    = array();
266
-        $geoms [] = new Point ($this->lon, $this->lat);
266
+        $geoms [] = new Point($this->lon, $this->lat);
267 267
         if (!empty ($this->markers)) {
268 268
             foreach ($this->markers as $marker) {
269
-                $geoms [] = new Point ($marker ['lon'], $marker ['lat']);
269
+                $geoms [] = new Point($marker ['lon'], $marker ['lat']);
270 270
             }
271 271
         }
272 272
         if (file_exists($this->kmlFileName)) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
             return;
294 294
         }
295 295
 
296
-        $geom     = new GeometryCollection ($geoms);
296
+        $geom     = new GeometryCollection($geoms);
297 297
         $centroid = $geom->centroid();
298 298
         $bbox     = $geom->getBBox();
299 299
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         $vy0 = log(tan(M_PI * (0.25 + $bbox ['miny'] / 360)));
303 303
         $vy1 = log(tan(M_PI * (0.25 + $bbox ['maxy'] / 360)));
304 304
         Logger::debug("StaticMap::autoZoom: vertical resolution: $vy0, $vy1");
305
-        if ($vy1 - $vy0 === 0.0){
305
+        if ($vy1 - $vy0 === 0.0) {
306 306
             $resolutionVertical = 0;
307 307
             Logger::debug("StaticMap::autoZoom: using $resolutionVertical");
308 308
         } else {
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         Logger::debug("StaticMap::autoZoom: using $resolutionHorizontal");
315 315
         $resolution           = max($resolutionHorizontal, $resolutionVertical) * $paddingFactor;
316 316
         $zoom                 = $this->zoom;
317
-        if ($resolution > 0){
317
+        if ($resolution > 0) {
318 318
             $zoom             = log(360 / ($resolution * $this->tileSize), 2);
319 319
         }
320 320
 
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
     public function mapCacheIDToFilename(): string
356 356
     {
357 357
         if (!$this->mapCacheFile) {
358
-            $this->mapCacheFile = $this->mapCacheBaseDir . "/" . $this->maptype . "/" . $this->zoom . "/cache_"
359
-                . substr($this->mapCacheID, 0, 2) . "/" . substr($this->mapCacheID, 2, 2)
360
-                . "/" . substr($this->mapCacheID, 4);
358
+            $this->mapCacheFile = $this->mapCacheBaseDir."/".$this->maptype."/".$this->zoom."/cache_"
359
+                . substr($this->mapCacheID, 0, 2)."/".substr($this->mapCacheID, 2, 2)
360
+                . "/".substr($this->mapCacheID, 4);
361 361
         }
362
-        return $this->mapCacheFile . "." . $this->mapCacheExtension;
362
+        return $this->mapCacheFile.".".$this->mapCacheExtension;
363 363
     }
364 364
 
365 365
     /**
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
             return $cached;
501 501
         }
502 502
 
503
-        $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')';
503
+        $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; '.PHP_OS.')';
504 504
         if (function_exists("curl_init")) {
505 505
             // use cUrl
506 506
             $ch = curl_init();
507 507
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
508 508
             curl_setopt($ch, CURLOPT_USERAGENT, $_UA);
509 509
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
510
-            curl_setopt($ch, CURLOPT_URL, $url . $this->apikey);
510
+            curl_setopt($ch, CURLOPT_URL, $url.$this->apikey);
511 511
             Logger::debug("StaticMap::fetchTile: getting: $url using curl_exec");
512 512
             $tile = curl_exec($ch);
513 513
             curl_close($ch);
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
             $opts = array(
518 518
                 'http' => array(
519 519
                     'method'          => "GET",
520
-                    'header'          => "Accept-language: en\r\n" . "User-Agent: $_UA\r\n" . "accept: image/png\r\n",
520
+                    'header'          => "Accept-language: en\r\n"."User-Agent: $_UA\r\n"."accept: image/png\r\n",
521 521
                     'request_fulluri' => true
522 522
                 )
523 523
             );
524 524
             if (isset($conf['proxy']['host'], $conf['proxy']['port'])
525 525
                 && $conf['proxy']['host'] !== ''
526 526
                 && $conf['proxy']['port'] !== '') {
527
-                $opts['http'] += ['proxy' => "tcp://" . $conf['proxy']['host'] . ":" . $conf['proxy']['port']];
527
+                $opts['http'] += ['proxy' => "tcp://".$conf['proxy']['host'].":".$conf['proxy']['port']];
528 528
             }
529 529
 
530 530
             $context = stream_context_create($opts);
531 531
             Logger::debug(
532 532
                 "StaticMap::fetchTile: getting: $url . $this->apikey using file_get_contents and options $opts"
533 533
             );
534
-            $tile = file_get_contents($url . $this->apikey, false, $context);
534
+            $tile = file_get_contents($url.$this->apikey, false, $context);
535 535
         }
536 536
         if ($tile && $this->useTileCache) {
537 537
             $this->writeTileToCache($url, $tile);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      */
561 561
     public function tileUrlToFilename(string $url): string
562 562
     {
563
-        return $this->tileCacheBaseDir . "/" . substr($url, strpos($url, '/') + 1);
563
+        return $this->tileCacheBaseDir."/".substr($url, strpos($url, '/') + 1);
564 564
     }
565 565
 
566 566
     /**
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
         $count               = 0;
599 599
         $color               = imagecolorallocate($this->image, 0, 0, 0);
600 600
         $bgcolor             = imagecolorallocate($this->image, 200, 200, 200);
601
-        $markerBaseDir       = __DIR__ . '/icons';
601
+        $markerBaseDir       = __DIR__.'/icons';
602 602
         $markerImageOffsetX  = 0;
603 603
         $markerImageOffsetY  = 0;
604 604
         $markerShadowOffsetX = 0;
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
             if ($markerType) {
619 619
                 foreach ($this->markerPrototypes as $markerPrototype) {
620 620
                     if (preg_match($markerPrototype ['regex'], $markerType, $matches)) {
621
-                        $markerFilename = $matches [0] . $markerPrototype ['extension'];
621
+                        $markerFilename = $matches [0].$markerPrototype ['extension'];
622 622
                         if ($markerPrototype ['offsetImage']) {
623 623
                             list ($markerImageOffsetX, $markerImageOffsetY) = explode(
624 624
                                 ",",
@@ -636,14 +636,14 @@  discard block
 block discarded – undo
636 636
                 }
637 637
             }
638 638
             // create img resource
639
-            if (file_exists($markerBaseDir . '/' . $markerFilename)) {
640
-                $markerImg = imagecreatefrompng($markerBaseDir . '/' . $markerFilename);
639
+            if (file_exists($markerBaseDir.'/'.$markerFilename)) {
640
+                $markerImg = imagecreatefrompng($markerBaseDir.'/'.$markerFilename);
641 641
             } else {
642
-                $markerImg = imagecreatefrompng($markerBaseDir . '/marker.png');
642
+                $markerImg = imagecreatefrompng($markerBaseDir.'/marker.png');
643 643
             }
644 644
             // check for shadow + create shadow recource
645
-            if ($markerShadow && file_exists($markerBaseDir . '/' . $markerShadow)) {
646
-                $markerShadowImg = imagecreatefrompng($markerBaseDir . '/' . $markerShadow);
645
+            if ($markerShadow && file_exists($markerBaseDir.'/'.$markerShadow)) {
646
+                $markerShadowImg = imagecreatefrompng($markerBaseDir.'/'.$markerShadow);
647 647
             }
648 648
             // calc position
649 649
             $destX = floor(
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
                 imagecopy(
660 660
                     $this->image,
661 661
                     $markerShadowImg,
662
-                    $destX + (int)$markerShadowOffsetX,
663
-                    $destY + (int)$markerShadowOffsetY,
662
+                    $destX + (int) $markerShadowOffsetX,
663
+                    $destY + (int) $markerShadowOffsetY,
664 664
                     0,
665 665
                     0,
666 666
                     imagesx($markerShadowImg),
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
             imagecopy(
672 672
                 $this->image,
673 673
                 $markerImg,
674
-                $destX + (int)$markerImageOffsetX,
675
-                $destY + (int)$markerImageOffsetY,
674
+                $destX + (int) $markerImageOffsetX,
675
+                $destY + (int) $markerImageOffsetY,
676 676
                 0,
677 677
                 0,
678 678
                 imagesx($markerImg),
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
                 $this->image,
684 684
                 3,
685 685
                 $destX - imagesx($markerImg) + 1,
686
-                $destY + (int)$markerImageOffsetY + 1,
686
+                $destY + (int) $markerImageOffsetY + 1,
687 687
                 ++$count,
688 688
                 $bgcolor
689 689
             );
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 $this->image,
692 692
                 3,
693 693
                 $destX - imagesx($markerImg),
694
-                $destY + (int)$markerImageOffsetY,
694
+                $destY + (int) $markerImageOffsetY,
695 695
                 $count,
696 696
                 $color
697 697
             );
@@ -873,8 +873,8 @@  discard block
 block discarded – undo
873 873
      */
874 874
     public function drawCopyright()
875 875
     {
876
-        $logoBaseDir = dirname(__FILE__) . '/' . 'logo/';
877
-        $logoImg     = imagecreatefrompng($logoBaseDir . $this->tileInfo ['openstreetmap'] ['logo']);
876
+        $logoBaseDir = dirname(__FILE__).'/'.'logo/';
877
+        $logoImg     = imagecreatefrompng($logoBaseDir.$this->tileInfo ['openstreetmap'] ['logo']);
878 878
         $textcolor   = imagecolorallocate($this->image, 0, 0, 0);
879 879
         $bgcolor     = imagecolorallocate($this->image, 200, 200, 200);
880 880
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
             $mapAuthor = "(c) OpenStreetMap maps/CC BY-SA";
912 912
         } else {
913 913
             $mapAuthor   = $this->tileInfo [$this->maptype] ['txt'];
914
-            $iconImg     = imagecreatefrompng($logoBaseDir . $this->tileInfo [$this->maptype] ['logo']);
914
+            $iconImg     = imagecreatefrompng($logoBaseDir.$this->tileInfo [$this->maptype] ['logo']);
915 915
             $xIconOffset = imagesx($iconImg);
916 916
             imagecopy(
917 917
                 $this->image,
Please login to merge, or discard this patch.