Passed
Pull Request — master (#8)
by Mark
03:51 queued 01:12
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.
_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.
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" controls="1" ';
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.
StaticMap.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -340,17 +340,17 @@
 block discarded – undo
340 340
     {
341 341
         return join(
342 342
             "&", array(
343
-                   $this->zoom,
344
-                   $this->lat,
345
-                   $this->lon,
346
-                   $this->width,
347
-                   $this->height,
348
-                   serialize($this->markers),
349
-                   $this->maptype,
350
-                   $this->kmlFileName,
351
-                   $this->gpxFileName,
352
-                   $this->geojsonFileName
353
-               )
343
+                    $this->zoom,
344
+                    $this->lat,
345
+                    $this->lon,
346
+                    $this->width,
347
+                    $this->height,
348
+                    serialize($this->markers),
349
+                    $this->maptype,
350
+                    $this->kmlFileName,
351
+                    $this->gpxFileName,
352
+                    $this->geojsonFileName
353
+                )
354 354
         );
355 355
     }
356 356
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 // phpcs:disable PSR1.Files.SideEffects
30 30
 // TODO resolve side effect
31
-require_once __DIR__ . '/../geophp/vendor/autoload.php';
31
+require_once __DIR__.'/../geophp/vendor/autoload.php';
32 32
 
33 33
 /**
34 34
  *
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
         $this->gpxFileName      = $gpx;
222 222
         $this->geojsonFileName  = $geojson;
223 223
         $this->mediaBaseDir     = $mediaDir;
224
-        $this->tileCacheBaseDir = $tileCacheBaseDir . '/olmaptiles';
224
+        $this->tileCacheBaseDir = $tileCacheBaseDir.'/olmaptiles';
225 225
         $this->useTileCache     = $this->tileCacheBaseDir !== '';
226
-        $this->mapCacheBaseDir  = $mediaDir . '/olmapmaps';
226
+        $this->mapCacheBaseDir  = $mediaDir.'/olmapmaps';
227 227
         $this->autoZoomExtent   = $autoZoomExtent;
228 228
         $this->apikey           = $apikey;
229 229
     }
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
     private function autoZoom(float $paddingFactor = 1.0): void
266 266
     {
267 267
         $geoms    = array();
268
-        $geoms [] = new Point ($this->lon, $this->lat);
268
+        $geoms [] = new Point($this->lon, $this->lat);
269 269
         if (!empty ($this->markers)) {
270 270
             foreach ($this->markers as $marker) {
271
-                $geoms [] = new Point ($marker ['lon'], $marker ['lat']);
271
+                $geoms [] = new Point($marker ['lon'], $marker ['lat']);
272 272
             }
273 273
         }
274 274
         if (file_exists($this->kmlFileName)) {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         Logger::debug("StaticMap::autoZoom: vertical resolution: $vy0, $vy1");
307
-        if ($vy1 - $vy0 === 0.0){
307
+        if ($vy1 - $vy0 === 0.0) {
308 308
             $resolutionVertical = 0;
309 309
             Logger::debug("StaticMap::autoZoom: using $resolutionVertical");
310 310
         } else {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         Logger::debug("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
 
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
     public function mapCacheIDToFilename(): string
358 358
     {
359 359
         if (!$this->mapCacheFile) {
360
-            $this->mapCacheFile = $this->mapCacheBaseDir . "/" . $this->maptype . "/" . $this->zoom . "/cache_"
361
-                . substr($this->mapCacheID, 0, 2) . "/" . substr($this->mapCacheID, 2, 2)
362
-                . "/" . substr($this->mapCacheID, 4);
360
+            $this->mapCacheFile = $this->mapCacheBaseDir."/".$this->maptype."/".$this->zoom."/cache_"
361
+                . substr($this->mapCacheID, 0, 2)."/".substr($this->mapCacheID, 2, 2)
362
+                . "/".substr($this->mapCacheID, 4);
363 363
         }
364
-        return $this->mapCacheFile . "." . $this->mapCacheExtension;
364
+        return $this->mapCacheFile.".".$this->mapCacheExtension;
365 365
     }
366 366
 
367 367
     /**
@@ -502,14 +502,14 @@  discard block
 block discarded – undo
502 502
             return $cached;
503 503
         }
504 504
 
505
-        $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')';
505
+        $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; '.PHP_OS.')';
506 506
         if (function_exists("curl_init")) {
507 507
             // use cUrl
508 508
             $ch = curl_init();
509 509
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
510 510
             curl_setopt($ch, CURLOPT_USERAGENT, $_UA);
511 511
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
512
-            curl_setopt($ch, CURLOPT_URL, $url . $this->apikey);
512
+            curl_setopt($ch, CURLOPT_URL, $url.$this->apikey);
513 513
             Logger::debug("StaticMap::fetchTile: getting: $url using curl_exec");
514 514
             $tile = curl_exec($ch);
515 515
             curl_close($ch);
@@ -519,21 +519,21 @@  discard block
 block discarded – undo
519 519
             $opts = array(
520 520
                 'http' => array(
521 521
                     'method'          => "GET",
522
-                    'header'          => "Accept-language: en\r\n" . "User-Agent: $_UA\r\n" . "accept: image/png\r\n",
522
+                    'header'          => "Accept-language: en\r\n"."User-Agent: $_UA\r\n"."accept: image/png\r\n",
523 523
                     'request_fulluri' => true
524 524
                 )
525 525
             );
526 526
             if (isset($conf['proxy']['host'], $conf['proxy']['port'])
527 527
                 && $conf['proxy']['host'] !== ''
528 528
                 && $conf['proxy']['port'] !== '') {
529
-                $opts['http'] += ['proxy' => "tcp://" . $conf['proxy']['host'] . ":" . $conf['proxy']['port']];
529
+                $opts['http'] += ['proxy' => "tcp://".$conf['proxy']['host'].":".$conf['proxy']['port']];
530 530
             }
531 531
 
532 532
             $context = stream_context_create($opts);
533 533
             Logger::debug(
534 534
                 "StaticMap::fetchTile: getting: $url . $this->apikey using file_get_contents and options $opts"
535 535
             );
536
-            $tile = file_get_contents($url . $this->apikey, false, $context);
536
+            $tile = file_get_contents($url.$this->apikey, false, $context);
537 537
         }
538 538
         if ($tile && $this->useTileCache) {
539 539
             $this->writeTileToCache($url, $tile);
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
      */
563 563
     public function tileUrlToFilename(string $url): string
564 564
     {
565
-        return $this->tileCacheBaseDir . "/" . substr($url, strpos($url, '/') + 1);
565
+        return $this->tileCacheBaseDir."/".substr($url, strpos($url, '/') + 1);
566 566
     }
567 567
 
568 568
     /**
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         $count               = 0;
601 601
         $color               = imagecolorallocate($this->image, 0, 0, 0);
602 602
         $bgcolor             = imagecolorallocate($this->image, 200, 200, 200);
603
-        $markerBaseDir       = __DIR__ . '/icons';
603
+        $markerBaseDir       = __DIR__.'/icons';
604 604
         $markerImageOffsetX  = 0;
605 605
         $markerImageOffsetY  = 0;
606 606
         $markerShadowOffsetX = 0;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
             if ($markerType) {
621 621
                 foreach ($this->markerPrototypes as $markerPrototype) {
622 622
                     if (preg_match($markerPrototype ['regex'], $markerType, $matches)) {
623
-                        $markerFilename = $matches [0] . $markerPrototype ['extension'];
623
+                        $markerFilename = $matches [0].$markerPrototype ['extension'];
624 624
                         if ($markerPrototype ['offsetImage']) {
625 625
                             list ($markerImageOffsetX, $markerImageOffsetY) = explode(
626 626
                                 ",",
@@ -638,14 +638,14 @@  discard block
 block discarded – undo
638 638
                 }
639 639
             }
640 640
             // create img resource
641
-            if (file_exists($markerBaseDir . '/' . $markerFilename)) {
642
-                $markerImg = imagecreatefrompng($markerBaseDir . '/' . $markerFilename);
641
+            if (file_exists($markerBaseDir.'/'.$markerFilename)) {
642
+                $markerImg = imagecreatefrompng($markerBaseDir.'/'.$markerFilename);
643 643
             } else {
644
-                $markerImg = imagecreatefrompng($markerBaseDir . '/marker.png');
644
+                $markerImg = imagecreatefrompng($markerBaseDir.'/marker.png');
645 645
             }
646 646
             // check for shadow + create shadow recource
647
-            if ($markerShadow && file_exists($markerBaseDir . '/' . $markerShadow)) {
648
-                $markerShadowImg = imagecreatefrompng($markerBaseDir . '/' . $markerShadow);
647
+            if ($markerShadow && file_exists($markerBaseDir.'/'.$markerShadow)) {
648
+                $markerShadowImg = imagecreatefrompng($markerBaseDir.'/'.$markerShadow);
649 649
             }
650 650
             // calc position
651 651
             $destX = floor(
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
                 imagecopy(
662 662
                     $this->image,
663 663
                     $markerShadowImg,
664
-                    $destX + (int)$markerShadowOffsetX,
665
-                    $destY + (int)$markerShadowOffsetY,
664
+                    $destX + (int) $markerShadowOffsetX,
665
+                    $destY + (int) $markerShadowOffsetY,
666 666
                     0,
667 667
                     0,
668 668
                     imagesx($markerShadowImg),
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
             imagecopy(
674 674
                 $this->image,
675 675
                 $markerImg,
676
-                $destX + (int)$markerImageOffsetX,
677
-                $destY + (int)$markerImageOffsetY,
676
+                $destX + (int) $markerImageOffsetX,
677
+                $destY + (int) $markerImageOffsetY,
678 678
                 0,
679 679
                 0,
680 680
                 imagesx($markerImg),
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
                 $this->image,
686 686
                 3,
687 687
                 $destX - imagesx($markerImg) + 1,
688
-                $destY + (int)$markerImageOffsetY + 1,
688
+                $destY + (int) $markerImageOffsetY + 1,
689 689
                 ++$count,
690 690
                 $bgcolor
691 691
             );
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
                 $this->image,
694 694
                 3,
695 695
                 $destX - imagesx($markerImg),
696
-                $destY + (int)$markerImageOffsetY,
696
+                $destY + (int) $markerImageOffsetY,
697 697
                 $count,
698 698
                 $color
699 699
             );
@@ -875,8 +875,8 @@  discard block
 block discarded – undo
875 875
      */
876 876
     public function drawCopyright()
877 877
     {
878
-        $logoBaseDir = dirname(__FILE__) . '/' . 'logo/';
879
-        $logoImg     = imagecreatefrompng($logoBaseDir . $this->tileInfo ['openstreetmap'] ['logo']);
878
+        $logoBaseDir = dirname(__FILE__).'/'.'logo/';
879
+        $logoImg     = imagecreatefrompng($logoBaseDir.$this->tileInfo ['openstreetmap'] ['logo']);
880 880
         $textcolor   = imagecolorallocate($this->image, 0, 0, 0);
881 881
         $bgcolor     = imagecolorallocate($this->image, 200, 200, 200);
882 882
 
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
             $mapAuthor = "(c) OpenStreetMap maps/CC BY-SA";
914 914
         } else {
915 915
             $mapAuthor   = $this->tileInfo [$this->maptype] ['txt'];
916
-            $iconImg     = imagecreatefrompng($logoBaseDir . $this->tileInfo [$this->maptype] ['logo']);
916
+            $iconImg     = imagecreatefrompng($logoBaseDir.$this->tileInfo [$this->maptype] ['logo']);
917 917
             $xIconOffset = imagesx($iconImg);
918 918
             imagecopy(
919 919
                 $this->image,
Please login to merge, or discard this patch.