Passed
Push — master ( 08f556...1e7188 )
by Mark
12:57 queued 10:36
created
icons/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 </head>
43 43
 <body>
44 44
 <div class="box"><?php
45
-    foreach(glob('*.png') as $img) {
46
-        echo '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" /> ';
45
+    foreach (glob('*.png') as $img) {
46
+        echo '<img src="'.$img.'" alt="'.$img.'" title="'.$img.'" /> ';
47 47
     }
48 48
     ?></div>
49 49
 </body>
Please login to merge, or discard this patch.
helper/staticmap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
 
81 81
         // normalize zoom
82 82
         $zoom = $zoom ?: 0;
83
-        if($zoom > 18) {
83
+        if ($zoom > 18) {
84 84
             $zoom = 18;
85 85
         }
86 86
         // normalize WxH
87 87
         list($width, $height) = explode('x', $size);
88 88
         $width = (int) $width;
89
-        if($width > $this->maxWidth) {
89
+        if ($width > $this->maxWidth) {
90 90
             $width = $this->maxWidth;
91 91
         }
92 92
         $height = (int) $height;
93
-        if($height > $this->maxHeight) {
93
+        if ($height > $this->maxHeight) {
94 94
             $height = $this->maxHeight;
95 95
         }
96 96
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
      */
126 126
     private function mediaIdToPath(string $id): string {
127 127
         global $conf;
128
-        if(empty($id)) {
128
+        if (empty($id)) {
129 129
             return "";
130 130
         }
131 131
         $id = str_replace(array("[[", "]]"), "", $id);
132
-        if((strpos($id, ':') === 0)) {
132
+        if ((strpos($id, ':') === 0)) {
133 133
             $id = substr($id, 1);
134 134
         }
135 135
         $id = str_replace(":", "/", $id);
136
-        return $conf['mediadir'] . '/' . $id;
136
+        return $conf['mediadir'].'/'.$id;
137 137
     }
138 138
 }
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
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      * Simple test to make sure the plugin.info.txt is in correct format.
31 31
      */
32 32
     final public function test_plugininfo(): void {
33
-        $file = __DIR__ . '/../plugin.info.txt';
33
+        $file = __DIR__.'/../plugin.info.txt';
34 34
         self::assertFileExists($file);
35 35
 
36 36
         $info = confToHash($file);
Please login to merge, or discard this patch.
syntax/olmap.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -617,8 +617,9 @@
 block discarded – undo
617 617
                 . "%2C" . $bbox ['maxlon'];
618 618
             $imgUrl .= "&dcl=1";
619 619
         }
620
-        if(strpos($imgUrl, "?") === false)
621
-            $imgUrl .= "?";
620
+        if(strpos($imgUrl, "?") === false) {
621
+                    $imgUrl .= "?";
622
+        }
622 623
 
623 624
         //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . ","
624 625
         //          . str_replace ( "px", "", $gmap ['height'] );
Please login to merge, or discard this 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.
admin/purge.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function getMenuIcon(): string {
36 36
         $plugin = $this->getPluginName();
37
-        return DOKU_PLUGIN . $plugin . '/admin/purge.svg';
37
+        return DOKU_PLUGIN.$plugin.'/admin/purge.svg';
38 38
     }
39 39
 
40 40
     /**
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function handle(): void {
45 45
         global $conf;
46
-        if(!isset($_REQUEST['continue']) || !checkSecurityToken()) {
46
+        if (!isset($_REQUEST['continue']) || !checkSecurityToken()) {
47 47
             return;
48 48
         }
49
-        if(isset($_REQUEST['purgetiles'])) {
50
-            $path = $conf['cachedir'] . '/olmaptiles';
51
-            if($this->rrmdir($path)) {
49
+        if (isset($_REQUEST['purgetiles'])) {
50
+            $path = $conf['cachedir'].'/olmaptiles';
51
+            if ($this->rrmdir($path)) {
52 52
                 msg($this->getLang('admin_purged_tiles'), 0);
53 53
             }
54 54
         }
55
-        if(isset($_REQUEST['purgemaps'])) {
56
-            $path = $conf['mediadir'] . '/olmapmaps';
57
-            if($this->rrmdir($path)) {
55
+        if (isset($_REQUEST['purgemaps'])) {
56
+            $path = $conf['mediadir'].'/olmapmaps';
57
+            if ($this->rrmdir($path)) {
58 58
                 msg($this->getLang('admin_purged_maps'), 0);
59 59
             }
60 60
         }
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
      * @return boolean true when succesful
67 67
      */
68 68
     private function rrmdir(string $sDir): bool {
69
-        if(is_dir($sDir)) {
69
+        if (is_dir($sDir)) {
70 70
             dbglog($sDir, 'admin_plugin_openlayersmap_purge::rrmdir: recursively removing path: ');
71 71
             $sDir = rtrim($sDir, '/');
72 72
             $oDir = dir($sDir);
73
-            while(($sFile = $oDir->read()) !== false) {
74
-                if($sFile !== '.' && $sFile !== '..') {
73
+            while (($sFile = $oDir->read()) !== false) {
74
+                if ($sFile !== '.' && $sFile !== '..') {
75 75
                     (!is_link("$sDir/$sFile") && is_dir("$sDir/$sFile")) ?
76 76
                         $this->rrmdir("$sDir/$sFile") : unlink("$sDir/$sFile");
77 77
                 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />'
99 99
         );
100 100
         $form->addElement(
101
-            '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles')
101
+            '<label for="purgetiles" class="label">'.$this->getLang('admin_purge_tiles')
102 102
             . '</label>'
103 103
         );
104 104
         $form->addElement('</p>');
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $form->addElement('<p>');
109 109
         $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />');
110 110
         $form->addElement(
111
-            '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>'
111
+            '<label for="purgemaps" class="label">'.$this->getLang('admin_purge_maps').'</label>'
112 112
         );
113 113
         $form->addElement('</p>');
114 114
         $form->endFieldset();
Please login to merge, or discard this patch.
StaticMap.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -471,8 +471,9 @@
 block discarded – undo
471 471
      *          for better proxy handling...
472 472
      */
473 473
     public function fetchTile(string $url) {
474
-        if($this->useTileCache && ($cached = $this->checkTileCache($url)))
475
-            return $cached;
474
+        if($this->useTileCache && ($cached = $this->checkTileCache($url))) {
475
+                    return $cached;
476
+        }
476 477
 
477 478
         $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')';
478 479
         if(function_exists("curl_init")) {
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -331,17 +331,17 @@
 block discarded – undo
331 331
     public function serializeParams(): string {
332 332
         return implode(
333 333
             "&", array(
334
-                   $this->zoom,
335
-                   $this->lat,
336
-                   $this->lon,
337
-                   $this->width,
338
-                   $this->height,
339
-                   serialize($this->markers),
340
-                   $this->maptype,
341
-                   $this->kmlFileName,
342
-                   $this->gpxFileName,
343
-                   $this->geojsonFileName
344
-               )
334
+                    $this->zoom,
335
+                    $this->lat,
336
+                    $this->lon,
337
+                    $this->width,
338
+                    $this->height,
339
+                    serialize($this->markers),
340
+                    $this->maptype,
341
+                    $this->kmlFileName,
342
+                    $this->gpxFileName,
343
+                    $this->geojsonFileName
344
+                )
345 345
         );
346 346
     }
347 347
 
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $this->height = $height;
216 216
         // validate + set maptype
217 217
         $this->maptype = $this->tileDefaultSrc;
218
-        if(array_key_exists($maptype, $this->tileInfo)) {
218
+        if (array_key_exists($maptype, $this->tileInfo)) {
219 219
             $this->maptype = $maptype;
220 220
         }
221 221
         $this->markers          = $markers;
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
         $this->gpxFileName      = $gpx;
224 224
         $this->geojsonFileName  = $geojson;
225 225
         $this->mediaBaseDir     = $mediaDir;
226
-        $this->tileCacheBaseDir = $tileCacheBaseDir . '/olmaptiles';
226
+        $this->tileCacheBaseDir = $tileCacheBaseDir.'/olmaptiles';
227 227
         $this->useTileCache     = $this->tileCacheBaseDir !== '';
228
-        $this->mapCacheBaseDir  = $mediaDir . '/olmapmaps';
228
+        $this->mapCacheBaseDir  = $mediaDir.'/olmapmaps';
229 229
         $this->autoZoomExtent   = $autoZoomExtent;
230 230
         $this->apikey           = $apikey;
231 231
     }
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function getMap(): string {
239 239
         try {
240
-            if($this->autoZoomExtent) {
240
+            if ($this->autoZoomExtent) {
241 241
                 $this->autoZoom();
242 242
             }
243
-        } catch(Exception $e) {
243
+        } catch (Exception $e) {
244 244
             dbglog($e);
245 245
         }
246 246
 
247 247
         // use map cache, so check cache for map
248
-        if(!$this->checkMapCache()) {
248
+        if (!$this->checkMapCache()) {
249 249
             // map is not in cache, needs to be build
250 250
             $this->makeMap();
251 251
             $this->mkdirRecursive(dirname($this->mapCacheIDToFilename()), 0777);
@@ -265,37 +265,37 @@  discard block
 block discarded – undo
265 265
      */
266 266
     private function autoZoom(float $paddingFactor = 1.0): void {
267 267
         $geoms    = array();
268
-        $geoms [] = new Point ($this->lon, $this->lat);
269
-        if(!empty ($this->markers)) {
270
-            foreach($this->markers as $marker) {
271
-                $geoms [] = new Point ($marker ['lon'], $marker ['lat']);
268
+        $geoms [] = new Point($this->lon, $this->lat);
269
+        if (!empty ($this->markers)) {
270
+            foreach ($this->markers as $marker) {
271
+                $geoms [] = new Point($marker ['lon'], $marker ['lat']);
272 272
             }
273 273
         }
274
-        if(file_exists($this->kmlFileName)) {
274
+        if (file_exists($this->kmlFileName)) {
275 275
             $g = geoPHP::load(file_get_contents($this->kmlFileName), 'kml');
276
-            if($g !== false) {
276
+            if ($g !== false) {
277 277
                 $geoms [] = $g;
278 278
             }
279 279
         }
280
-        if(file_exists($this->gpxFileName)) {
280
+        if (file_exists($this->gpxFileName)) {
281 281
             $g = geoPHP::load(file_get_contents($this->gpxFileName), 'gpx');
282
-            if($g !== false) {
282
+            if ($g !== false) {
283 283
                 $geoms [] = $g;
284 284
             }
285 285
         }
286
-        if(file_exists($this->geojsonFileName)) {
286
+        if (file_exists($this->geojsonFileName)) {
287 287
             $g = geoPHP::load(file_get_contents($this->geojsonFileName), 'geojson');
288
-            if($g !== false) {
288
+            if ($g !== false) {
289 289
                 $geoms [] = $g;
290 290
             }
291 291
         }
292 292
 
293
-        if(count($geoms) <= 1) {
293
+        if (count($geoms) <= 1) {
294 294
             dbglog($geoms, "StaticMap::autoZoom: Skip setting autozoom options");
295 295
             return;
296 296
         }
297 297
 
298
-        $geom     = new GeometryCollection ($geoms);
298
+        $geom     = new GeometryCollection($geoms);
299 299
         $centroid = $geom->centroid();
300 300
         $bbox     = $geom->getBBox();
301 301
 
@@ -304,7 +304,7 @@  discard block
 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
         dbglog("StaticMap::autoZoom: vertical resolution: $vy0, $vy1");
307
-        if ($vy1 - $vy0 === 0.0){
307
+        if ($vy1 - $vy0 === 0.0) {
308 308
             $resolutionVertical = 0;
309 309
             dbglog("StaticMap::autoZoom: using $resolutionVertical");
310 310
         } else {
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
         dbglog("StaticMap::autoZoom: using $resolutionHorizontal");
317 317
         $resolution           = max($resolutionHorizontal, $resolutionVertical) * $paddingFactor;
318 318
         $zoom                 = $this->zoom;
319
-        if ($resolution > 0){
319
+        if ($resolution > 0) {
320 320
             $zoom             = log(360 / ($resolution * $this->tileSize), 2);
321 321
         }
322 322
 
323
-        if(is_finite($zoom) && $zoom < 15 && $zoom > 2) {
323
+        if (is_finite($zoom) && $zoom < 15 && $zoom > 2) {
324 324
             $this->zoom = floor($zoom);
325 325
         }
326 326
         $this->lon = $centroid->getX();
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
     }
354 354
 
355 355
     public function mapCacheIDToFilename(): string {
356
-        if(!$this->mapCacheFile) {
357
-            $this->mapCacheFile = $this->mapCacheBaseDir . "/" . $this->maptype . "/" . $this->zoom . "/cache_"
358
-                . substr($this->mapCacheID, 0, 2) . "/" . substr($this->mapCacheID, 2, 2)
359
-                . "/" . substr($this->mapCacheID, 4);
356
+        if (!$this->mapCacheFile) {
357
+            $this->mapCacheFile = $this->mapCacheBaseDir."/".$this->maptype."/".$this->zoom."/cache_"
358
+                . substr($this->mapCacheID, 0, 2)."/".substr($this->mapCacheID, 2, 2)
359
+                . "/".substr($this->mapCacheID, 4);
360 360
         }
361
-        return $this->mapCacheFile . "." . $this->mapCacheExtension;
361
+        return $this->mapCacheFile.".".$this->mapCacheExtension;
362 362
     }
363 363
 
364 364
     /**
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     public function makeMap(): void {
368 368
         $this->initCoords();
369 369
         $this->createBaseMap();
370
-        if(!empty ($this->markers)) {
370
+        if (!empty ($this->markers)) {
371 371
             $this->placeMarkers();
372 372
         }
373 373
         if (file_exists($this->kmlFileName)) {
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
         $this->offsetX += floor($startX - floor($this->centerX)) * $this->tileSize;
441 441
         $this->offsetY += floor($startY - floor($this->centerY)) * $this->tileSize;
442 442
 
443
-        for($x = $startX; $x <= $endX; $x++) {
444
-            for($y = $startY; $y <= $endY; $y++) {
443
+        for ($x = $startX; $x <= $endX; $x++) {
444
+            for ($y = $startY; $y <= $endY; $y++) {
445 445
                 $url = str_replace(
446 446
                     array(
447 447
                         '{Z}',
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
                 );
456 456
 
457 457
                 $tileData = $this->fetchTile($url);
458
-                if($tileData) {
458
+                if ($tileData) {
459 459
                     $tileImage = imagecreatefromstring($tileData);
460 460
                 } else {
461 461
                     $tileImage = imagecreate($this->tileSize, $this->tileSize);
@@ -481,17 +481,17 @@  discard block
 block discarded – undo
481 481
      *          for better proxy handling...
482 482
      */
483 483
     public function fetchTile(string $url) {
484
-        if($this->useTileCache && ($cached = $this->checkTileCache($url)))
484
+        if ($this->useTileCache && ($cached = $this->checkTileCache($url)))
485 485
             return $cached;
486 486
 
487
-        $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; ' . PHP_OS . ')';
488
-        if(function_exists("curl_init")) {
487
+        $_UA = 'Mozilla/4.0 (compatible; DokuWikiSpatial HTTP Client; '.PHP_OS.')';
488
+        if (function_exists("curl_init")) {
489 489
             // use cUrl
490 490
             $ch = curl_init();
491 491
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
492 492
             curl_setopt($ch, CURLOPT_USERAGENT, $_UA);
493 493
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
494
-            curl_setopt($ch, CURLOPT_URL, $url . $this->apikey);
494
+            curl_setopt($ch, CURLOPT_URL, $url.$this->apikey);
495 495
             dbglog("StaticMap::fetchTile: getting: $url using curl_exec");
496 496
             $tile = curl_exec($ch);
497 497
             curl_close($ch);
@@ -501,21 +501,21 @@  discard block
 block discarded – undo
501 501
             $opts = array(
502 502
                 'http' => array(
503 503
                     'method'          => "GET",
504
-                    'header'          => "Accept-language: en\r\n" . "User-Agent: $_UA\r\n" . "accept: image/png\r\n",
504
+                    'header'          => "Accept-language: en\r\n"."User-Agent: $_UA\r\n"."accept: image/png\r\n",
505 505
                     'request_fulluri' => true
506 506
                 )
507 507
             );
508
-            if(isset($conf['proxy']['host'], $conf['proxy']['port'])
508
+            if (isset($conf['proxy']['host'], $conf['proxy']['port'])
509 509
                 && $conf['proxy']['host'] !== ''
510 510
                 && $conf['proxy']['port'] !== '') {
511
-                $opts['http'] += ['proxy' => "tcp://" . $conf['proxy']['host'] . ":" . $conf['proxy']['port']];
511
+                $opts['http'] += ['proxy' => "tcp://".$conf['proxy']['host'].":".$conf['proxy']['port']];
512 512
             }
513 513
 
514 514
             $context = stream_context_create($opts);
515 515
             // dbglog("StaticMap::fetchTile: getting: $url . $this->apikey using file_get_contents and options $opts");
516
-            $tile = file_get_contents($url . $this->apikey, false, $context);
516
+            $tile = file_get_contents($url.$this->apikey, false, $context);
517 517
         }
518
-        if($tile && $this->useTileCache) {
518
+        if ($tile && $this->useTileCache) {
519 519
             $this->writeTileToCache($url, $tile);
520 520
         }
521 521
         return $tile;
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
      */
529 529
     public function checkTileCache(string $url) {
530 530
         $filename = $this->tileUrlToFilename($url);
531
-        if(file_exists($filename)) {
531
+        if (file_exists($filename)) {
532 532
             return file_get_contents($filename);
533 533
         }
534 534
         return false;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      * @return string
541 541
      */
542 542
     public function tileUrlToFilename(string $url): string {
543
-        return $this->tileCacheBaseDir . "/" . substr($url, strpos($url, '/') + 1);
543
+        return $this->tileCacheBaseDir."/".substr($url, strpos($url, '/') + 1);
544 544
     }
545 545
 
546 546
     /**
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
         $count         = 0;
576 576
         $color         = imagecolorallocate($this->image, 0, 0, 0);
577 577
         $bgcolor       = imagecolorallocate($this->image, 200, 200, 200);
578
-        $markerBaseDir = __DIR__ . '/icons';
578
+        $markerBaseDir = __DIR__.'/icons';
579 579
         $markerImageOffsetX  = 0;
580 580
         $markerImageOffsetY  = 0;
581 581
         $markerShadowOffsetX = 0;
582 582
         $markerShadowOffsetY = 0;
583 583
         $markerShadowImg     = null;
584 584
         // loop thru marker array
585
-        foreach($this->markers as $marker) {
585
+        foreach ($this->markers as $marker) {
586 586
             // set some local variables
587 587
             $markerLat  = $marker ['lat'];
588 588
             $markerLon  = $marker ['lon'];
@@ -592,18 +592,18 @@  discard block
 block discarded – undo
592 592
             $markerShadow   = '';
593 593
             $matches        = false;
594 594
             // check for marker type, get settings from markerPrototypes
595
-            if($markerType) {
596
-                foreach($this->markerPrototypes as $markerPrototype) {
597
-                    if(preg_match($markerPrototype ['regex'], $markerType, $matches)) {
598
-                        $markerFilename = $matches [0] . $markerPrototype ['extension'];
599
-                        if($markerPrototype ['offsetImage']) {
595
+            if ($markerType) {
596
+                foreach ($this->markerPrototypes as $markerPrototype) {
597
+                    if (preg_match($markerPrototype ['regex'], $markerType, $matches)) {
598
+                        $markerFilename = $matches [0].$markerPrototype ['extension'];
599
+                        if ($markerPrototype ['offsetImage']) {
600 600
                             list ($markerImageOffsetX, $markerImageOffsetY) = explode(
601 601
                                 ",",
602 602
                                 $markerPrototype ['offsetImage']
603 603
                             );
604 604
                         }
605 605
                         $markerShadow = $markerPrototype ['shadow'];
606
-                        if($markerShadow) {
606
+                        if ($markerShadow) {
607 607
                             list ($markerShadowOffsetX, $markerShadowOffsetY) = explode(
608 608
                                 ",",
609 609
                                 $markerPrototype ['offsetShadow']
@@ -613,14 +613,14 @@  discard block
 block discarded – undo
613 613
                 }
614 614
             }
615 615
             // create img resource
616
-            if(file_exists($markerBaseDir . '/' . $markerFilename)) {
617
-                $markerImg = imagecreatefrompng($markerBaseDir . '/' . $markerFilename);
616
+            if (file_exists($markerBaseDir.'/'.$markerFilename)) {
617
+                $markerImg = imagecreatefrompng($markerBaseDir.'/'.$markerFilename);
618 618
             } else {
619
-                $markerImg = imagecreatefrompng($markerBaseDir . '/marker.png');
619
+                $markerImg = imagecreatefrompng($markerBaseDir.'/marker.png');
620 620
             }
621 621
             // check for shadow + create shadow recource
622
-            if($markerShadow && file_exists($markerBaseDir . '/' . $markerShadow)) {
623
-                $markerShadowImg = imagecreatefrompng($markerBaseDir . '/' . $markerShadow);
622
+            if ($markerShadow && file_exists($markerBaseDir.'/'.$markerShadow)) {
623
+                $markerShadowImg = imagecreatefrompng($markerBaseDir.'/'.$markerShadow);
624 624
             }
625 625
             // calc position
626 626
             $destX = floor(
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
                 $this->tileSize * ($this->centerY - $this->latToTile($markerLat, $this->zoom))
633 633
             );
634 634
             // copy shadow on basemap
635
-            if($markerShadow && $markerShadowImg) {
635
+            if ($markerShadow && $markerShadowImg) {
636 636
                 imagecopy(
637 637
                     $this->image,
638 638
                     $markerShadowImg,
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
      *            drawing colour
695 695
      */
696 696
     private function drawGeometry(Geometry $geom, int $colour): void {
697
-        if(empty($geom)) {
697
+        if (empty($geom)) {
698 698
             return;
699 699
         }
700 700
 
701
-        switch($geom->geometryType()) {
701
+        switch ($geom->geometryType()) {
702 702
             case 'GeometryCollection' :
703 703
                 // recursively draw part of the collection
704
-                for($i = 1; $i < $geom->numGeometries() + 1; $i++) {
704
+                for ($i = 1; $i < $geom->numGeometries() + 1; $i++) {
705 705
                     $_geom = $geom->geometryN($i);
706 706
                     $this->drawGeometry($_geom, $colour);
707 707
                 }
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
         // extring is a linestring actually..
744 744
         $extRing = $polygon->exteriorRing();
745 745
 
746
-        for($i = 1; $i < $extRing->numGeometries(); $i++) {
746
+        for ($i = 1; $i < $extRing->numGeometries(); $i++) {
747 747
             $p1           = $extRing->geometryN($i);
748 748
             $x            = floor(
749 749
                 ($this->width / 2) - $this->tileSize * ($this->centerX - $this->lonToTile($p1->x(), $this->zoom))
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      */
770 770
     private function drawLineString($line, $colour) {
771 771
         imagesetthickness($this->image, 2);
772
-        for($p = 1; $p < $line->numGeometries(); $p++) {
772
+        for ($p = 1; $p < $line->numGeometries(); $p++) {
773 773
             // get first pair of points
774 774
             $p1 = $line->geometryN($p);
775 775
             $p2 = $line->geometryN($p + 1);
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
      * add copyright and origin notice and icons to the map.
843 843
      */
844 844
     public function drawCopyright() {
845
-        $logoBaseDir = dirname(__FILE__) . '/' . 'logo/';
846
-        $logoImg     = imagecreatefrompng($logoBaseDir . $this->tileInfo ['openstreetmap'] ['logo']);
845
+        $logoBaseDir = dirname(__FILE__).'/'.'logo/';
846
+        $logoImg     = imagecreatefrompng($logoBaseDir.$this->tileInfo ['openstreetmap'] ['logo']);
847 847
         $textcolor   = imagecolorallocate($this->image, 0, 0, 0);
848 848
         $bgcolor     = imagecolorallocate($this->image, 200, 200, 200);
849 849
 
@@ -876,11 +876,11 @@  discard block
 block discarded – undo
876 876
 
877 877
         // additional tile source info, ie. who created/hosted the tiles
878 878
         $xIconOffset = 0;
879
-        if($this->maptype === 'openstreetmap') {
879
+        if ($this->maptype === 'openstreetmap') {
880 880
             $mapAuthor = "(c) OpenStreetMap maps/CC BY-SA";
881 881
         } else {
882 882
             $mapAuthor   = $this->tileInfo [$this->maptype] ['txt'];
883
-            $iconImg     = imagecreatefrompng($logoBaseDir . $this->tileInfo [$this->maptype] ['logo']);
883
+            $iconImg     = imagecreatefrompng($logoBaseDir.$this->tileInfo [$this->maptype] ['logo']);
884 884
             $xIconOffset = imagesx($iconImg);
885 885
             imagecopy(
886 886
                 $this->image,
Please login to merge, or discard this patch.
syntax/wmslayer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,13 +119,13 @@
 block discarded – undo
119 119
         // incremented for each olmap_wmslayer tag in the page source
120 120
         static $overlaynumber = 0;
121 121
 
122
-        $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,';
123
-        $str           = '{';
122
+        $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,';
123
+        $str = '{';
124 124
         foreach ($data as $key => $val) {
125
-            $str .= "'" . $key . "' : '" . $val . "',";
125
+            $str .= "'".$key."' : '".$val."',";
126 126
         }
127 127
         $str           .= "'type':'wms'}";
128
-        $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";")
128
+        $renderer->doc .= base64_encode("olMapOverlays['wms".$overlaynumber."'] = ".$str.";")
129 129
             . '"></script>';
130 130
         $overlaynumber++;
131 131
         return true;
Please login to merge, or discard this patch.
syntax/osmlayer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,13 +116,13 @@
 block discarded – undo
116 116
         // incremented for each olmap_osmlayer tag in the page source
117 117
         static $overlaynumber = 0;
118 118
 
119
-        $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,';
120
-        $str           = '{';
119
+        $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,';
120
+        $str = '{';
121 121
         foreach ($data as $key => $val) {
122
-            $str .= "'" . $key . "' : '" . $val . "',";
122
+            $str .= "'".$key."' : '".$val."',";
123 123
         }
124 124
         $str           .= '"type":"osm"}';
125
-        $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";")
125
+        $renderer->doc .= base64_encode("olMapOverlays['osm".$overlaynumber."'] = ".$str.";")
126 126
             . '"></script>';
127 127
         $overlaynumber++;
128 128
         return true;
Please login to merge, or discard this patch.
syntax/agslayer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,13 +120,13 @@
 block discarded – undo
120 120
         // incremented for each olmap_agslayer tag in the page source
121 121
         static $overlaynumber = 0;
122 122
 
123
-        $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,';
124
-        $str           = '{';
123
+        $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,';
124
+        $str = '{';
125 125
         foreach ($data as $key => $val) {
126
-            $str .= "'" . $key . "' : '" . $val . "',";
126
+            $str .= "'".$key."' : '".$val."',";
127 127
         }
128 128
         $str           .= "'type':'ags'}";
129
-        $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";")
129
+        $renderer->doc .= base64_encode("olMapOverlays['ags".$overlaynumber."'] = ".$str.";")
130 130
             . '"></script>';
131 131
         $overlaynumber++;
132 132
         return true;
Please login to merge, or discard this patch.