@@ -42,8 +42,8 @@ |
||
| 42 | 42 | </head> |
| 43 | 43 | <body> |
| 44 | 44 | <div class="box"><?php |
| 45 | - foreach(glob('*.png') as $img) { |
|
| 46 | - echo '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" /> '; |
|
| 45 | + foreach (glob('*.png') as $img) { |
|
| 46 | + echo '<img src="'.$img.'" alt="'.$img.'" title="'.$img.'" /> '; |
|
| 47 | 47 | } |
| 48 | 48 | ?></div> |
| 49 | 49 | </body> |
@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // normalize zoom |
| 82 | 82 | $zoom = $zoom ?: 0; |
| 83 | - if($zoom > 18) { |
|
| 83 | + if ($zoom > 18) { |
|
| 84 | 84 | $zoom = 18; |
| 85 | 85 | } |
| 86 | 86 | // normalize WxH |
| 87 | 87 | list($width, $height) = explode('x', $size); |
| 88 | 88 | $width = (int) $width; |
| 89 | - if($width > $this->maxWidth) { |
|
| 89 | + if ($width > $this->maxWidth) { |
|
| 90 | 90 | $width = $this->maxWidth; |
| 91 | 91 | } |
| 92 | 92 | $height = (int) $height; |
| 93 | - if($height > $this->maxHeight) { |
|
| 93 | + if ($height > $this->maxHeight) { |
|
| 94 | 94 | $height = $this->maxHeight; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function mediaIdToPath(string $id): string { |
| 127 | 127 | global $conf; |
| 128 | - if(empty($id)) { |
|
| 128 | + if (empty($id)) { |
|
| 129 | 129 | return ""; |
| 130 | 130 | } |
| 131 | 131 | $id = str_replace(array("[[", "]]"), "", $id); |
| 132 | - if((strpos($id, ':') === 0)) { |
|
| 132 | + if ((strpos($id, ':') === 0)) { |
|
| 133 | 133 | $id = substr($id, 1); |
| 134 | 134 | } |
| 135 | 135 | $id = str_replace(":", "/", $id); |
| 136 | - return $conf['mediadir'] . '/' . $id; |
|
| 136 | + return $conf['mediadir'].'/'.$id; |
|
| 137 | 137 | } |
| 138 | 138 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * Simple test to make sure the plugin.info.txt is in correct format. |
| 31 | 31 | */ |
| 32 | 32 | final public function test_plugininfo(): void { |
| 33 | - $file = __DIR__ . '/../plugin.info.txt'; |
|
| 33 | + $file = __DIR__.'/../plugin.info.txt'; |
|
| 34 | 34 | self::assertFileExists($file); |
| 35 | 35 | |
| 36 | 36 | $info = confToHash($file); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function getMenuIcon(): string { |
| 36 | 36 | $plugin = $this->getPluginName(); |
| 37 | - return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
| 37 | + return DOKU_PLUGIN.$plugin.'/admin/purge.svg'; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -43,18 +43,18 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function handle(): void { |
| 45 | 45 | global $conf; |
| 46 | - if(!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
| 46 | + if (!isset($_REQUEST['continue']) || !checkSecurityToken()) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | - if(isset($_REQUEST['purgetiles'])) { |
|
| 50 | - $path = $conf['cachedir'] . '/olmaptiles'; |
|
| 51 | - if($this->rrmdir($path)) { |
|
| 49 | + if (isset($_REQUEST['purgetiles'])) { |
|
| 50 | + $path = $conf['cachedir'].'/olmaptiles'; |
|
| 51 | + if ($this->rrmdir($path)) { |
|
| 52 | 52 | msg($this->getLang('admin_purged_tiles'), 0); |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | - if(isset($_REQUEST['purgemaps'])) { |
|
| 56 | - $path = $conf['mediadir'] . '/olmapmaps'; |
|
| 57 | - if($this->rrmdir($path)) { |
|
| 55 | + if (isset($_REQUEST['purgemaps'])) { |
|
| 56 | + $path = $conf['mediadir'].'/olmapmaps'; |
|
| 57 | + if ($this->rrmdir($path)) { |
|
| 58 | 58 | msg($this->getLang('admin_purged_maps'), 0); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | * @return boolean true when succesful |
| 67 | 67 | */ |
| 68 | 68 | private function rrmdir(string $sDir): bool { |
| 69 | - if(is_dir($sDir)) { |
|
| 69 | + if (is_dir($sDir)) { |
|
| 70 | 70 | dbglog($sDir, 'admin_plugin_openlayersmap_purge::rrmdir: recursively removing path: '); |
| 71 | 71 | $sDir = rtrim($sDir, '/'); |
| 72 | 72 | $oDir = dir($sDir); |
| 73 | - while(($sFile = $oDir->read()) !== false) { |
|
| 74 | - if($sFile !== '.' && $sFile !== '..') { |
|
| 73 | + while (($sFile = $oDir->read()) !== false) { |
|
| 74 | + if ($sFile !== '.' && $sFile !== '..') { |
|
| 75 | 75 | (!is_link("$sDir/$sFile") && is_dir("$sDir/$sFile")) ? |
| 76 | 76 | $this->rrmdir("$sDir/$sFile") : unlink("$sDir/$sFile"); |
| 77 | 77 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | '<input id="purgetiles" name="purgetiles" type="checkbox" value="1" class="checkbox" />' |
| 99 | 99 | ); |
| 100 | 100 | $form->addElement( |
| 101 | - '<label for="purgetiles" class="label">' . $this->getLang('admin_purge_tiles') |
|
| 101 | + '<label for="purgetiles" class="label">'.$this->getLang('admin_purge_tiles') |
|
| 102 | 102 | . '</label>' |
| 103 | 103 | ); |
| 104 | 104 | $form->addElement('</p>'); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $form->addElement('<p>'); |
| 109 | 109 | $form->addElement('<input id="purgemaps" name="purgemaps" type="checkbox" value="1" class="checkbox" />'); |
| 110 | 110 | $form->addElement( |
| 111 | - '<label for="purgemaps" class="label">' . $this->getLang('admin_purge_maps') . '</label>' |
|
| 111 | + '<label for="purgemaps" class="label">'.$this->getLang('admin_purge_maps').'</label>' |
|
| 112 | 112 | ); |
| 113 | 113 | $form->addElement('</p>'); |
| 114 | 114 | $form->endFieldset(); |
@@ -119,13 +119,13 @@ |
||
| 119 | 119 | // incremented for each olmap_wmslayer tag in the page source |
| 120 | 120 | static $overlaynumber = 0; |
| 121 | 121 | |
| 122 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
| 123 | - $str = '{'; |
|
| 122 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
| 123 | + $str = '{'; |
|
| 124 | 124 | foreach ($data as $key => $val) { |
| 125 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
| 125 | + $str .= "'".$key."' : '".$val."',"; |
|
| 126 | 126 | } |
| 127 | 127 | $str .= "'type':'wms'}"; |
| 128 | - $renderer->doc .= base64_encode("olMapOverlays['wms" . $overlaynumber . "'] = " . $str . ";") |
|
| 128 | + $renderer->doc .= base64_encode("olMapOverlays['wms".$overlaynumber."'] = ".$str.";") |
|
| 129 | 129 | . '"></script>'; |
| 130 | 130 | $overlaynumber++; |
| 131 | 131 | return true; |
@@ -116,13 +116,13 @@ |
||
| 116 | 116 | // incremented for each olmap_osmlayer tag in the page source |
| 117 | 117 | static $overlaynumber = 0; |
| 118 | 118 | |
| 119 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
| 120 | - $str = '{'; |
|
| 119 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
| 120 | + $str = '{'; |
|
| 121 | 121 | foreach ($data as $key => $val) { |
| 122 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
| 122 | + $str .= "'".$key."' : '".$val."',"; |
|
| 123 | 123 | } |
| 124 | 124 | $str .= '"type":"osm"}'; |
| 125 | - $renderer->doc .= base64_encode("olMapOverlays['osm" . $overlaynumber . "'] = " . $str . ";") |
|
| 125 | + $renderer->doc .= base64_encode("olMapOverlays['osm".$overlaynumber."'] = ".$str.";") |
|
| 126 | 126 | . '"></script>'; |
| 127 | 127 | $overlaynumber++; |
| 128 | 128 | return true; |
@@ -120,13 +120,13 @@ |
||
| 120 | 120 | // incremented for each olmap_agslayer tag in the page source |
| 121 | 121 | static $overlaynumber = 0; |
| 122 | 122 | |
| 123 | - $renderer->doc .= DOKU_LF . '<script defer="defer" src="data:text/javascript;base64,'; |
|
| 124 | - $str = '{'; |
|
| 123 | + $renderer->doc .= DOKU_LF.'<script defer="defer" src="data:text/javascript;base64,'; |
|
| 124 | + $str = '{'; |
|
| 125 | 125 | foreach ($data as $key => $val) { |
| 126 | - $str .= "'" . $key . "' : '" . $val . "',"; |
|
| 126 | + $str .= "'".$key."' : '".$val."',"; |
|
| 127 | 127 | } |
| 128 | 128 | $str .= "'type':'ags'}"; |
| 129 | - $renderer->doc .= base64_encode("olMapOverlays['ags" . $overlaynumber . "'] = " . $str . ";") |
|
| 129 | + $renderer->doc .= base64_encode("olMapOverlays['ags".$overlaynumber."'] = ".$str.";") |
|
| 130 | 130 | . '"></script>'; |
| 131 | 131 | $overlaynumber++; |
| 132 | 132 | return true; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $conf['plugin']['openlayersmap']['optionStaticMapGenerator'] = 'local'; |
| 39 | 39 | $conf['plugin']['openlayersmap']['autoZoomMap'] = 1; |
| 40 | 40 | |
| 41 | - TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/'); |
|
| 41 | + TestUtils::rcopy(TMP_DIR, __DIR__.'/data/'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | final public function setUp(): void { |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | // foreach($data as $val) { |
| 51 | 51 | // idx_addPage($val['id']); |
| 52 | 52 | // } |
| 53 | - if($conf['allowdebug']) { |
|
| 54 | - if(mkdir(DOKU_TMP_DATA . 'data/log/debug/', 0777, true)) { |
|
| 55 | - touch(DOKU_TMP_DATA . 'data/log/debug/' . date('Y-m-d') . '.log'); |
|
| 53 | + if ($conf['allowdebug']) { |
|
| 54 | + if (mkdir(DOKU_TMP_DATA.'data/log/debug/', 0777, true)) { |
|
| 55 | + touch(DOKU_TMP_DATA.'data/log/debug/'.date('Y-m-d').'.log'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | global $conf; |
| 65 | 65 | // try to get the debug log after running the test, print and clear |
| 66 | - if($conf['allowdebug']) { |
|
| 66 | + if ($conf['allowdebug']) { |
|
| 67 | 67 | print "\n"; |
| 68 | - readfile(DOKU_TMP_DATA . 'data/log/debug/' . date('Y-m-d') . '.log'); |
|
| 69 | - unlink(DOKU_TMP_DATA . 'data/log/debug/' . date('Y-m-d') . '.log'); |
|
| 68 | + readfile(DOKU_TMP_DATA.'data/log/debug/'.date('Y-m-d').'.log'); |
|
| 69 | + unlink(DOKU_TMP_DATA.'data/log/debug/'.date('Y-m-d').'.log'); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | // break matched data into its components |
| 90 | 90 | $_tag = explode('>', substr($match, 7, -9), 2); |
| 91 | 91 | $str_params = $_tag[0]; |
| 92 | - if(array_key_exists(1, $_tag)) { |
|
| 92 | + if (array_key_exists(1, $_tag)) { |
|
| 93 | 93 | $str_points = $_tag[1]; |
| 94 | 94 | } else { |
| 95 | 95 | $str_points = ''; |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | preg_match('(lon[:|=]\"-?\d*\.?\d*\")', $match, $mainLon); |
| 100 | 100 | $mainLat = substr($mainLat [0], 5, -1); |
| 101 | 101 | $mainLon = substr($mainLon [0], 5, -1); |
| 102 | - if(!is_numeric($mainLat)) { |
|
| 102 | + if (!is_numeric($mainLat)) { |
|
| 103 | 103 | $mainLat = $this->dflt ['lat']; |
| 104 | 104 | } |
| 105 | - if(!is_numeric($mainLon)) { |
|
| 105 | + if (!is_numeric($mainLon)) { |
|
| 106 | 106 | $mainLon = $this->dflt ['lon']; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -113,23 +113,23 @@ discard block |
||
| 113 | 113 | $_nocache = false; |
| 114 | 114 | // choose maptype based on the specified tag |
| 115 | 115 | $imgUrl = "{{"; |
| 116 | - if(stripos($gmap ['baselyr'], 'google') !== false) { |
|
| 116 | + if (stripos($gmap ['baselyr'], 'google') !== false) { |
|
| 117 | 117 | |
| 118 | 118 | $imgUrl .= $this->getGoogle($gmap, $overlay); |
| 119 | 119 | $imgUrl .= "&.png"; |
| 120 | - } elseif(stripos($gmap ['baselyr'], 'bing') !== false) { |
|
| 120 | + } elseif (stripos($gmap ['baselyr'], 'bing') !== false) { |
|
| 121 | 121 | // Bing |
| 122 | - if(!$this->getConf('bingAPIKey')) { |
|
| 122 | + if (!$this->getConf('bingAPIKey')) { |
|
| 123 | 123 | // in case there is no Bing api key we'll use OSM |
| 124 | 124 | $_firstimageID = $this->getStaticOSM($gmap, $overlay); |
| 125 | - $imgUrl .= $_firstimageID; |
|
| 126 | - if($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 125 | + $imgUrl .= $_firstimageID; |
|
| 126 | + if ($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 127 | 127 | $imgUrl .= "&.png"; |
| 128 | 128 | } |
| 129 | 129 | } else { |
| 130 | 130 | // seems that Bing doesn't like the DW client, turn off caching |
| 131 | 131 | $_nocache = true; |
| 132 | - $imgUrl .= $this->getBing($gmap, $overlay) . "&.png"; |
|
| 132 | + $imgUrl .= $this->getBing($gmap, $overlay)."&.png"; |
|
| 133 | 133 | } |
| 134 | 134 | } /* elseif (stripos ( $gmap ['baselyr'], 'mapquest' ) !== false) { |
| 135 | 135 | // MapQuest |
@@ -147,33 +147,33 @@ discard block |
||
| 147 | 147 | } */ else { |
| 148 | 148 | // default OSM |
| 149 | 149 | $_firstimageID = $this->getStaticOSM($gmap, $overlay); |
| 150 | - $imgUrl .= $_firstimageID; |
|
| 151 | - if($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 150 | + $imgUrl .= $_firstimageID; |
|
| 151 | + if ($this->getConf('optionStaticMapGenerator') == 'remote') { |
|
| 152 | 152 | $imgUrl .= "&.png"; |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // append dw p_render specific params and render |
| 157 | - $imgUrl .= "?" . str_replace("px", "", $gmap ['width']) . "x" |
|
| 157 | + $imgUrl .= "?".str_replace("px", "", $gmap ['width'])."x" |
|
| 158 | 158 | . str_replace("px", "", $gmap ['height']); |
| 159 | 159 | $imgUrl .= "&nolink"; |
| 160 | 160 | |
| 161 | 161 | // add nocache option for selected services |
| 162 | - if($_nocache) { |
|
| 162 | + if ($_nocache) { |
|
| 163 | 163 | $imgUrl .= "&nocache"; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $imgUrl .= " |" . $gmap ['summary'] . " }}"; |
|
| 166 | + $imgUrl .= " |".$gmap ['summary']." }}"; |
|
| 167 | 167 | |
| 168 | 168 | // dbglog($imgUrl,"complete image tags is:"); |
| 169 | 169 | |
| 170 | 170 | $mapid = $gmap ['id']; |
| 171 | 171 | // create a javascript parameter string for the map |
| 172 | 172 | $param = ''; |
| 173 | - foreach($gmap as $key => $val) { |
|
| 174 | - $param .= is_numeric($val) ? "$key: $val, " : "$key: '" . hsc($val) . "', "; |
|
| 173 | + foreach ($gmap as $key => $val) { |
|
| 174 | + $param .= is_numeric($val) ? "$key: $val, " : "$key: '".hsc($val)."', "; |
|
| 175 | 175 | } |
| 176 | - if(!empty ($param)) { |
|
| 176 | + if (!empty ($param)) { |
|
| 177 | 177 | $param = substr($param, 0, -2); |
| 178 | 178 | } |
| 179 | 179 | unset ($gmap ['id']); |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | $poi = ''; |
| 183 | 183 | $poitable = ''; |
| 184 | 184 | $rowId = 0; |
| 185 | - if(!empty ($overlay)) { |
|
| 186 | - foreach($overlay as $data) { |
|
| 185 | + if (!empty ($overlay)) { |
|
| 186 | + foreach ($overlay as $data) { |
|
| 187 | 187 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 188 | 188 | $rowId++; |
| 189 | 189 | $poi .= ", {lat:$lat,lon:$lon,txt:'$text',angle:$angle,opacity:$opacity,img:'$img',rowId: $rowId}"; |
| 190 | 190 | |
| 191 | - if($this->getConf('displayformat') === 'DMS') { |
|
| 191 | + if ($this->getConf('displayformat') === 'DMS') { |
|
| 192 | 192 | $lat = $this->convertLat($lat); |
| 193 | 193 | $lon = $this->convertLon($lon); |
| 194 | 194 | } else { |
@@ -198,52 +198,52 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $poitable .= ' |
| 200 | 200 | <tr> |
| 201 | - <td class="rowId">' . $rowId . '</td> |
|
| 202 | - <td class="icon"><img src="' . DOKU_BASE . 'lib/plugins/openlayersmap/icons/' . $img . '" alt="' |
|
| 203 | - . substr($img, 0, -4) . $this->getlang('alt_legend_poi') . '" /></td> |
|
| 204 | - <td class="lat" title="' . $this->getLang('olmapPOIlatTitle') . '">' . $lat . '</td> |
|
| 205 | - <td class="lon" title="' . $this->getLang('olmapPOIlonTitle') . '">' . $lon . '</td> |
|
| 206 | - <td class="txt">' . $text . '</td> |
|
| 201 | + <td class="rowId">' . $rowId.'</td> |
|
| 202 | + <td class="icon"><img src="' . DOKU_BASE.'lib/plugins/openlayersmap/icons/'.$img.'" alt="' |
|
| 203 | + . substr($img, 0, -4).$this->getlang('alt_legend_poi').'" /></td> |
|
| 204 | + <td class="lat" title="' . $this->getLang('olmapPOIlatTitle').'">'.$lat.'</td> |
|
| 205 | + <td class="lon" title="' . $this->getLang('olmapPOIlonTitle').'">'.$lon.'</td> |
|
| 206 | + <td class="txt">' . $text.'</td> |
|
| 207 | 207 | </tr>'; |
| 208 | 208 | } |
| 209 | 209 | $poi = substr($poi, 2); |
| 210 | 210 | } |
| 211 | - if(!empty ($gmap ['kmlfile'])) { |
|
| 211 | + if (!empty ($gmap ['kmlfile'])) { |
|
| 212 | 212 | $poitable .= ' |
| 213 | 213 | <tr> |
| 214 | 214 | <td class="rowId"><img src="' . DOKU_BASE |
| 215 | 215 | . 'lib/plugins/openlayersmap/toolbar/kml_file.png" alt="KML file" /></td> |
| 216 | - <td class="icon"><img src="' . DOKU_BASE . 'lib/plugins/openlayersmap/toolbar/kml_line.png" alt="' |
|
| 217 | - . $this->getlang('alt_legend_kml') . '" /></td> |
|
| 218 | - <td class="txt" colspan="3">KML track: ' . $this->getFileName($gmap ['kmlfile']) . '</td> |
|
| 216 | + <td class="icon"><img src="' . DOKU_BASE.'lib/plugins/openlayersmap/toolbar/kml_line.png" alt="' |
|
| 217 | + . $this->getlang('alt_legend_kml').'" /></td> |
|
| 218 | + <td class="txt" colspan="3">KML track: ' . $this->getFileName($gmap ['kmlfile']).'</td> |
|
| 219 | 219 | </tr>'; |
| 220 | 220 | } |
| 221 | - if(!empty ($gmap ['gpxfile'])) { |
|
| 221 | + if (!empty ($gmap ['gpxfile'])) { |
|
| 222 | 222 | $poitable .= ' |
| 223 | 223 | <tr> |
| 224 | 224 | <td class="rowId"><img src="' . DOKU_BASE |
| 225 | 225 | . 'lib/plugins/openlayersmap/toolbar/gpx_file.png" alt="GPX file" /></td> |
| 226 | 226 | <td class="icon"><img src="' . DOKU_BASE |
| 227 | 227 | . 'lib/plugins/openlayersmap/toolbar/gpx_line.png" alt="' |
| 228 | - . $this->getlang('alt_legend_gpx') . '" /></td> |
|
| 229 | - <td class="txt" colspan="3">GPX track: ' . $this->getFileName($gmap ['gpxfile']) . '</td> |
|
| 228 | + . $this->getlang('alt_legend_gpx').'" /></td> |
|
| 229 | + <td class="txt" colspan="3">GPX track: ' . $this->getFileName($gmap ['gpxfile']).'</td> |
|
| 230 | 230 | </tr>'; |
| 231 | 231 | } |
| 232 | - if(!empty ($gmap ['geojsonfile'])) { |
|
| 232 | + if (!empty ($gmap ['geojsonfile'])) { |
|
| 233 | 233 | $poitable .= ' |
| 234 | 234 | <tr> |
| 235 | 235 | <td class="rowId"><img src="' . DOKU_BASE |
| 236 | 236 | . 'lib/plugins/openlayersmap/toolbar/geojson_file.png" alt="GeoJSON file" /></td> |
| 237 | 237 | <td class="icon"><img src="' . DOKU_BASE |
| 238 | 238 | . 'lib/plugins/openlayersmap/toolbar/geojson_line.png" alt="' |
| 239 | - . $this->getlang('alt_legend_geojson') . '" /></td> |
|
| 240 | - <td class="txt" colspan="3">GeoJSON track: ' . $this->getFileName($gmap ['geojsonfile']) . '</td> |
|
| 239 | + . $this->getlang('alt_legend_geojson').'" /></td> |
|
| 240 | + <td class="txt" colspan="3">GeoJSON track: ' . $this->getFileName($gmap ['geojsonfile']).'</td> |
|
| 241 | 241 | </tr>'; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $autozoom = empty ($gmap ['autozoom']) ? $this->getConf('autoZoomMap') : $gmap ['autozoom']; |
| 245 | - $js = "{mapOpts: {" . $param . ", displayformat: '" . $this->getConf('displayformat') |
|
| 246 | - . "', autozoom: " . $autozoom . "}, poi: [$poi]};"; |
|
| 245 | + $js = "{mapOpts: {".$param.", displayformat: '".$this->getConf('displayformat') |
|
| 246 | + . "', autozoom: ".$autozoom."}, poi: [$poi]};"; |
|
| 247 | 247 | // unescape the json |
| 248 | 248 | $poitable = stripslashes($poitable); |
| 249 | 249 | |
@@ -271,21 +271,21 @@ discard block |
||
| 271 | 271 | preg_match_all('/(\w*)="(.*?)"/us', $str_params, $param, PREG_SET_ORDER); |
| 272 | 272 | // parse match for instructions, break into key value pairs |
| 273 | 273 | $gmap = $this->dflt; |
| 274 | - foreach($gmap as $key => &$value) { |
|
| 275 | - $defval = $this->getConf('default_' . $key); |
|
| 276 | - if($defval !== '') { |
|
| 274 | + foreach ($gmap as $key => &$value) { |
|
| 275 | + $defval = $this->getConf('default_'.$key); |
|
| 276 | + if ($defval !== '') { |
|
| 277 | 277 | $value = $defval; |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | unset ($value); |
| 281 | - foreach($param as $kvpair) { |
|
| 281 | + foreach ($param as $kvpair) { |
|
| 282 | 282 | list ($match, $key, $val) = $kvpair; |
| 283 | 283 | $key = strtolower($key); |
| 284 | - if(isset ($gmap [$key])) { |
|
| 285 | - if($key == 'summary') { |
|
| 284 | + if (isset ($gmap [$key])) { |
|
| 285 | + if ($key == 'summary') { |
|
| 286 | 286 | // preserve case for summary field |
| 287 | 287 | $gmap [$key] = $val; |
| 288 | - } elseif($key == 'id') { |
|
| 288 | + } elseif ($key == 'id') { |
|
| 289 | 289 | // preserve case for id field |
| 290 | 290 | $gmap [$key] = $val; |
| 291 | 291 | } else { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | ); |
| 322 | 322 | // create poi array |
| 323 | 323 | $overlay = array(); |
| 324 | - foreach($point as $pt) { |
|
| 324 | + foreach ($point as $pt) { |
|
| 325 | 325 | list ($match, $lat, $lon, $angle, $opacity, $img, $text) = $pt; |
| 326 | 326 | $lat = is_numeric($lat) ? $lat : 0; |
| 327 | 327 | $lon = is_numeric($lon) ? $lon : 0; |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | private function getGoogle(array $gmap, array $overlay): string { |
| 357 | 357 | $sUrl = $this->getConf('iconUrlOverload'); |
| 358 | - if(!$sUrl) { |
|
| 358 | + if (!$sUrl) { |
|
| 359 | 359 | $sUrl = DOKU_URL; |
| 360 | 360 | } |
| 361 | - switch($gmap ['baselyr']) { |
|
| 361 | + switch ($gmap ['baselyr']) { |
|
| 362 | 362 | case 'google hybrid' : |
| 363 | 363 | $maptype = 'hybrid'; |
| 364 | 364 | break; |
@@ -378,29 +378,29 @@ discard block |
||
| 378 | 378 | // see: https://developers.google.com/maps/documentation/staticmaps/index#Viewports |
| 379 | 379 | // http://maps.google.com/maps/api/staticmap?center=51.565690,5.456756&zoom=16&size=600x400&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/marker.png|label:1|51.565690,5.456756&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/marker-blue.png|51.566197,5.458966|label:2&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/parking.png|51.567177,5.457909|label:3&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/parking.png|51.566283,5.457330|label:4&markers=icon:http://wild-water.nl/dokuwiki/lib/plugins/openlayersmap/icons/parking.png|51.565630,5.457695|label:5&sensor=false&format=png&maptype=roadmap |
| 380 | 380 | $imgUrl = "https://maps.googleapis.com/maps/api/staticmap?"; |
| 381 | - $imgUrl .= "&size=" . str_replace("px", "", $gmap ['width']) . "x" |
|
| 381 | + $imgUrl .= "&size=".str_replace("px", "", $gmap ['width'])."x" |
|
| 382 | 382 | . str_replace("px", "", $gmap ['height']); |
| 383 | 383 | //if (!$this->getConf( 'autoZoomMap')) { // no need for center & zoom params } |
| 384 | - $imgUrl .= "¢er=" . $gmap ['lat'] . "," . $gmap ['lon']; |
|
| 384 | + $imgUrl .= "¢er=".$gmap ['lat'].",".$gmap ['lon']; |
|
| 385 | 385 | // max is 21 (== building scale), but that's overkill.. |
| 386 | - if($gmap ['zoom'] > 17) { |
|
| 386 | + if ($gmap ['zoom'] > 17) { |
|
| 387 | 387 | $imgUrl .= "&zoom=17"; |
| 388 | 388 | } else { |
| 389 | - $imgUrl .= "&zoom=" . $gmap ['zoom']; |
|
| 389 | + $imgUrl .= "&zoom=".$gmap ['zoom']; |
|
| 390 | 390 | } |
| 391 | - if(!empty ($overlay)) { |
|
| 391 | + if (!empty ($overlay)) { |
|
| 392 | 392 | $rowId = 0; |
| 393 | - foreach($overlay as $data) { |
|
| 393 | + foreach ($overlay as $data) { |
|
| 394 | 394 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 395 | - $imgUrl .= "&markers=icon%3a" . $sUrl . "lib/plugins/openlayersmap/icons/" . $img . "%7c" |
|
| 396 | - . $lat . "," . $lon . "%7clabel%3a" . ++$rowId; |
|
| 395 | + $imgUrl .= "&markers=icon%3a".$sUrl."lib/plugins/openlayersmap/icons/".$img."%7c" |
|
| 396 | + . $lat.",".$lon."%7clabel%3a".++$rowId; |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | - $imgUrl .= "&format=png&maptype=" . $maptype; |
|
| 399 | + $imgUrl .= "&format=png&maptype=".$maptype; |
|
| 400 | 400 | global $conf; |
| 401 | - $imgUrl .= "&language=" . $conf ['lang']; |
|
| 402 | - if($this->getConf('googleAPIkey')) { |
|
| 403 | - $imgUrl .= "&key=" . $this->getConf('googleAPIkey'); |
|
| 401 | + $imgUrl .= "&language=".$conf ['lang']; |
|
| 402 | + if ($this->getConf('googleAPIkey')) { |
|
| 403 | + $imgUrl .= "&key=".$this->getConf('googleAPIkey'); |
|
| 404 | 404 | } |
| 405 | 405 | // dbglog($imgUrl,'syntax_plugin_openlayersmap_olmap::getGoogle: Google image url is:'); |
| 406 | 406 | return $imgUrl; |
@@ -483,23 +483,23 @@ discard block |
||
| 483 | 483 | private function getStaticOSM(array $gmap, array $overlay) { |
| 484 | 484 | global $conf; |
| 485 | 485 | |
| 486 | - if($this->getConf('optionStaticMapGenerator') == 'local') { |
|
| 486 | + if ($this->getConf('optionStaticMapGenerator') == 'local') { |
|
| 487 | 487 | // using local basemap composer |
| 488 | - if(!$myMap = plugin_load('helper', 'openlayersmap_staticmap')) { |
|
| 488 | + if (!$myMap = plugin_load('helper', 'openlayersmap_staticmap')) { |
|
| 489 | 489 | dbglog( |
| 490 | 490 | $myMap, |
| 491 | 491 | 'openlayersmap_staticmap plugin is not available for use.' |
| 492 | 492 | ); |
| 493 | 493 | } |
| 494 | - if(!$geophp = plugin_load('helper', 'geophp')) { |
|
| 494 | + if (!$geophp = plugin_load('helper', 'geophp')) { |
|
| 495 | 495 | dbglog($geophp, 'geophp plugin is not available for use.'); |
| 496 | 496 | } |
| 497 | - $size = str_replace("px", "", $gmap ['width']) . "x" |
|
| 497 | + $size = str_replace("px", "", $gmap ['width'])."x" |
|
| 498 | 498 | . str_replace("px", "", $gmap ['height']); |
| 499 | 499 | |
| 500 | 500 | $markers = array(); |
| 501 | - if(!empty ($overlay)) { |
|
| 502 | - foreach($overlay as $data) { |
|
| 501 | + if (!empty ($overlay)) { |
|
| 502 | + foreach ($overlay as $data) { |
|
| 503 | 503 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 504 | 504 | $iconStyle = substr($img, 0, strlen($img) - 4); |
| 505 | 505 | $markers [] = array( |
@@ -511,26 +511,26 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | $apikey = ''; |
| 514 | - switch($gmap ['baselyr']) { |
|
| 514 | + switch ($gmap ['baselyr']) { |
|
| 515 | 515 | case 'mapnik' : |
| 516 | 516 | case 'openstreetmap' : |
| 517 | 517 | $maptype = 'openstreetmap'; |
| 518 | 518 | break; |
| 519 | 519 | case 'transport' : |
| 520 | 520 | $maptype = 'transport'; |
| 521 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 521 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 522 | 522 | break; |
| 523 | 523 | case 'landscape' : |
| 524 | 524 | $maptype = 'landscape'; |
| 525 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 525 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 526 | 526 | break; |
| 527 | 527 | case 'outdoors' : |
| 528 | 528 | $maptype = 'outdoors'; |
| 529 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 529 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 530 | 530 | break; |
| 531 | 531 | case 'cycle map' : |
| 532 | 532 | $maptype = 'cycle'; |
| 533 | - $apikey = '?apikey=' . $this->getConf('tfApiKey'); |
|
| 533 | + $apikey = '?apikey='.$this->getConf('tfApiKey'); |
|
| 534 | 534 | break; |
| 535 | 535 | case 'hike and bike map' : |
| 536 | 536 | $maptype = 'hikeandbike'; |
@@ -559,25 +559,25 @@ discard block |
||
| 559 | 559 | // ol-marker|47.921629720114,18.027343747285,ol-marker-gold|47.951071133739,19.257812497236, |
| 560 | 560 | // ol-marker-blue|47.180141361692,19.257812497236,ol-marker-green |
| 561 | 561 | $imgUrl = "https://staticmap.openstreetmap.de/staticmap.php"; |
| 562 | - $imgUrl .= "?center=" . $gmap ['lat'] . "," . $gmap ['lon']; |
|
| 563 | - $imgUrl .= "&size=" . str_replace("px", "", $gmap ['width']) . "x" |
|
| 562 | + $imgUrl .= "?center=".$gmap ['lat'].",".$gmap ['lon']; |
|
| 563 | + $imgUrl .= "&size=".str_replace("px", "", $gmap ['width'])."x" |
|
| 564 | 564 | . str_replace("px", "", $gmap ['height']); |
| 565 | 565 | |
| 566 | - if($gmap ['zoom'] > 16) { |
|
| 566 | + if ($gmap ['zoom'] > 16) { |
|
| 567 | 567 | // actually this could even be 18, but that seems overkill |
| 568 | 568 | $imgUrl .= "&zoom=16"; |
| 569 | 569 | } else { |
| 570 | - $imgUrl .= "&zoom=" . $gmap ['zoom']; |
|
| 570 | + $imgUrl .= "&zoom=".$gmap ['zoom']; |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | - if(!empty ($overlay)) { |
|
| 574 | - $rowId = 0; |
|
| 573 | + if (!empty ($overlay)) { |
|
| 574 | + $rowId = 0; |
|
| 575 | 575 | $imgUrl .= "&markers="; |
| 576 | - foreach($overlay as $data) { |
|
| 576 | + foreach ($overlay as $data) { |
|
| 577 | 577 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 578 | 578 | $rowId++; |
| 579 | 579 | $iconStyle = "lightblue$rowId"; |
| 580 | - $imgUrl .= "$lat,$lon,$iconStyle%7c"; |
|
| 580 | + $imgUrl .= "$lat,$lon,$iconStyle%7c"; |
|
| 581 | 581 | } |
| 582 | 582 | $imgUrl = substr($imgUrl, 0, -3); |
| 583 | 583 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * @return string |
| 597 | 597 | */ |
| 598 | 598 | private function getBing(array $gmap, array $overlay): string { |
| 599 | - switch($gmap ['baselyr']) { |
|
| 599 | + switch ($gmap ['baselyr']) { |
|
| 600 | 600 | case 've hybrid' : |
| 601 | 601 | case 'bing hybrid' : |
| 602 | 602 | $maptype = 'AerialWithLabels'; |
@@ -613,33 +613,33 @@ discard block |
||
| 613 | 613 | $maptype = 'Road'; |
| 614 | 614 | break; |
| 615 | 615 | } |
| 616 | - $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/" . $maptype;// . "/"; |
|
| 617 | - if($this->getConf('autoZoomMap')) { |
|
| 616 | + $imgUrl = "https://dev.virtualearth.net/REST/v1/Imagery/Map/".$maptype; // . "/"; |
|
| 617 | + if ($this->getConf('autoZoomMap')) { |
|
| 618 | 618 | $bbox = $this->calcBBOX($overlay, $gmap ['lat'], $gmap ['lon']); |
| 619 | 619 | //$imgUrl .= "?ma=" . $bbox ['minlat'] . "," . $bbox ['minlon'] . "," |
| 620 | 620 | // . $bbox ['maxlat'] . "," . $bbox ['maxlon']; |
| 621 | - $imgUrl .= "?ma=" . $bbox ['minlat'] . "%2C" . $bbox ['minlon'] . "%2C" . $bbox ['maxlat'] |
|
| 622 | - . "%2C" . $bbox ['maxlon']; |
|
| 621 | + $imgUrl .= "?ma=".$bbox ['minlat']."%2C".$bbox ['minlon']."%2C".$bbox ['maxlat'] |
|
| 622 | + . "%2C".$bbox ['maxlon']; |
|
| 623 | 623 | $imgUrl .= "&dcl=1"; |
| 624 | 624 | } |
| 625 | - if(strpos($imgUrl, "?") === false) |
|
| 625 | + if (strpos($imgUrl, "?") === false) |
|
| 626 | 626 | $imgUrl .= "?"; |
| 627 | 627 | |
| 628 | 628 | //$imgUrl .= "&ms=" . str_replace ( "px", "", $gmap ['width'] ) . "," |
| 629 | 629 | // . str_replace ( "px", "", $gmap ['height'] ); |
| 630 | - $imgUrl .= "&ms=" . str_replace("px", "", $gmap ['width']) . "%2C" |
|
| 630 | + $imgUrl .= "&ms=".str_replace("px", "", $gmap ['width'])."%2C" |
|
| 631 | 631 | . str_replace("px", "", $gmap ['height']); |
| 632 | - $imgUrl .= "&key=" . $this->getConf('bingAPIKey'); |
|
| 633 | - if(!empty ($overlay)) { |
|
| 632 | + $imgUrl .= "&key=".$this->getConf('bingAPIKey'); |
|
| 633 | + if (!empty ($overlay)) { |
|
| 634 | 634 | $rowId = 0; |
| 635 | - foreach($overlay as $data) { |
|
| 635 | + foreach ($overlay as $data) { |
|
| 636 | 636 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 637 | 637 | // TODO icon style lookup, see: http://msdn.microsoft.com/en-us/library/ff701719.aspx for iconStyle |
| 638 | 638 | $iconStyle = 32; |
| 639 | 639 | $rowId++; |
| 640 | 640 | // NOTE: the max number of pushpins is 18! or we have to use POST |
| 641 | 641 | // (http://msdn.microsoft.com/en-us/library/ff701724.aspx) |
| 642 | - if($rowId == 18) { |
|
| 642 | + if ($rowId == 18) { |
|
| 643 | 643 | break; |
| 644 | 644 | } |
| 645 | 645 | //$imgUrl .= "&pp=$lat,$lon;$iconStyle;$rowId"; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | global $conf; |
| 651 | 651 | $imgUrl .= "&fmt=png"; |
| 652 | - $imgUrl .= "&c=" . $conf ['lang']; |
|
| 652 | + $imgUrl .= "&c=".$conf ['lang']; |
|
| 653 | 653 | // dbglog($imgUrl,'syntax_plugin_openlayersmap_olmap::getBing: bing image url is:'); |
| 654 | 654 | return $imgUrl; |
| 655 | 655 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | private function calcBBOX(array $overlay, float $lat, float $lon): array { |
| 669 | 669 | $lats = array($lat); |
| 670 | 670 | $lons = array($lon); |
| 671 | - foreach($overlay as $data) { |
|
| 671 | + foreach ($overlay as $data) { |
|
| 672 | 672 | list ($lat, $lon, $text, $angle, $opacity, $img) = $data; |
| 673 | 673 | $lats [] = $lat; |
| 674 | 674 | $lons [] = $lon; |
@@ -696,13 +696,13 @@ discard block |
||
| 696 | 696 | * @todo move this into a shared library |
| 697 | 697 | */ |
| 698 | 698 | private function convertLat(float $decimaldegrees): string { |
| 699 | - if(strpos($decimaldegrees, '-') !== false) { |
|
| 699 | + if (strpos($decimaldegrees, '-') !== false) { |
|
| 700 | 700 | $latPos = "S"; |
| 701 | 701 | } else { |
| 702 | 702 | $latPos = "N"; |
| 703 | 703 | } |
| 704 | 704 | $dms = $this->convertDDtoDMS(abs($decimaldegrees)); |
| 705 | - return hsc($dms . $latPos); |
|
| 705 | + return hsc($dms.$latPos); |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | $secs = ($decimaldegrees - $dms) * 3600; |
| 718 | 718 | $min = floor($secs / 60); |
| 719 | 719 | $sec = round($secs - ($min * 60), 3); |
| 720 | - $dms .= 'º' . $min . '\'' . $sec . '"'; |
|
| 720 | + $dms .= 'º'.$min.'\''.$sec.'"'; |
|
| 721 | 721 | return $dms; |
| 722 | 722 | } |
| 723 | 723 | |
@@ -729,13 +729,13 @@ discard block |
||
| 729 | 729 | * @todo move this into a shared library |
| 730 | 730 | */ |
| 731 | 731 | private function convertLon(float $decimaldegrees): string { |
| 732 | - if(strpos($decimaldegrees, '-') !== false) { |
|
| 732 | + if (strpos($decimaldegrees, '-') !== false) { |
|
| 733 | 733 | $lonPos = "W"; |
| 734 | 734 | } else { |
| 735 | 735 | $lonPos = "E"; |
| 736 | 736 | } |
| 737 | 737 | $dms = $this->convertDDtoDMS(abs($decimaldegrees)); |
| 738 | - return hsc($dms . $lonPos); |
|
| 738 | + return hsc($dms.$lonPos); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -766,60 +766,60 @@ discard block |
||
| 766 | 766 | // dbglog($data, 'olmap::render() data.'); |
| 767 | 767 | list ($mapid, $param, $mainLat, $mainLon, $poitable, $poitabledesc, $staticImgUrl, $_firstimage) = $data; |
| 768 | 768 | |
| 769 | - if($format == 'xhtml') { |
|
| 769 | + if ($format == 'xhtml') { |
|
| 770 | 770 | $olscript = ''; |
| 771 | 771 | $stamenEnable = $this->getConf('enableStamen'); |
| 772 | 772 | $osmEnable = $this->getConf('enableOSM'); |
| 773 | 773 | $enableBing = $this->getConf('enableBing'); |
| 774 | 774 | |
| 775 | 775 | $scriptEnable = ''; |
| 776 | - if(!$initialised) { |
|
| 776 | + if (!$initialised) { |
|
| 777 | 777 | $initialised = true; |
| 778 | 778 | // render necessary script tags only once |
| 779 | - $olscript = '<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol7/ol.js"></script> |
|
| 780 | -<script defer="defer" src="' . DOKU_BASE . 'lib/plugins/openlayersmap/ol7/ol-layerswitcher.js"></script>'; |
|
| 779 | + $olscript = '<script defer="defer" src="'.DOKU_BASE.'lib/plugins/openlayersmap/ol7/ol.js"></script> |
|
| 780 | +<script defer="defer" src="' . DOKU_BASE.'lib/plugins/openlayersmap/ol7/ol-layerswitcher.js"></script>'; |
|
| 781 | 781 | |
| 782 | 782 | $scriptEnable = '<script defer="defer" src="data:text/javascript;base64,'; |
| 783 | 783 | $scriptSrc = $olscript ? 'const olEnable=true;' : 'const olEnable=false;'; |
| 784 | - $scriptSrc .= 'const osmEnable=' . ($osmEnable ? 'true' : 'false') . ';'; |
|
| 785 | - $scriptSrc .= 'const stamenEnable=' . ($stamenEnable ? 'true' : 'false') . ';'; |
|
| 786 | - $scriptSrc .= 'const bEnable=' . ($enableBing ? 'true' : 'false') . ';'; |
|
| 787 | - $scriptSrc .= 'const bApiKey="' . $this->getConf('bingAPIKey') . '";'; |
|
| 788 | - $scriptSrc .= 'const tfApiKey="' . $this->getConf('tfApiKey') . '";'; |
|
| 789 | - $scriptSrc .= 'const gApiKey="' . $this->getConf('googleAPIkey') . '";'; |
|
| 784 | + $scriptSrc .= 'const osmEnable='.($osmEnable ? 'true' : 'false').';'; |
|
| 785 | + $scriptSrc .= 'const stamenEnable='.($stamenEnable ? 'true' : 'false').';'; |
|
| 786 | + $scriptSrc .= 'const bEnable='.($enableBing ? 'true' : 'false').';'; |
|
| 787 | + $scriptSrc .= 'const bApiKey="'.$this->getConf('bingAPIKey').'";'; |
|
| 788 | + $scriptSrc .= 'const tfApiKey="'.$this->getConf('tfApiKey').'";'; |
|
| 789 | + $scriptSrc .= 'const gApiKey="'.$this->getConf('googleAPIkey').'";'; |
|
| 790 | 790 | $scriptSrc .= 'olMapData = []; let olMaps = {}; let olMapOverlays = {};'; |
| 791 | 791 | $scriptEnable .= base64_encode($scriptSrc); |
| 792 | 792 | $scriptEnable .= '"></script>'; |
| 793 | 793 | } |
| 794 | 794 | $renderer->doc .= "$olscript\n$scriptEnable"; |
| 795 | - $renderer->doc .= '<div class="olMapHelp">' . $this->locale_xhtml("help") . '</div>'; |
|
| 796 | - if($this->getConf('enableA11y')) { |
|
| 797 | - $renderer->doc .= '<div id="' . $mapid . '-static" class="olStaticMap">' |
|
| 798 | - . p_render($format, p_get_instructions($staticImgUrl), $info) . '</div>'; |
|
| 795 | + $renderer->doc .= '<div class="olMapHelp">'.$this->locale_xhtml("help").'</div>'; |
|
| 796 | + if ($this->getConf('enableA11y')) { |
|
| 797 | + $renderer->doc .= '<div id="'.$mapid.'-static" class="olStaticMap">' |
|
| 798 | + . p_render($format, p_get_instructions($staticImgUrl), $info).'</div>'; |
|
| 799 | 799 | } |
| 800 | - $renderer->doc .= '<div id="' . $mapid . '-clearer" class="clearer"><p> </p></div>'; |
|
| 801 | - if($this->getConf('enableA11y')) { |
|
| 800 | + $renderer->doc .= '<div id="'.$mapid.'-clearer" class="clearer"><p> </p></div>'; |
|
| 801 | + if ($this->getConf('enableA11y')) { |
|
| 802 | 802 | // render a table of the POI for the print and a11y presentation, it is hidden using javascript |
| 803 | 803 | $renderer->doc .= ' |
| 804 | - <div id="' . $mapid . '-table-span" class="olPOItableSpan"> |
|
| 805 | - <table id="' . $mapid . '-table" class="olPOItable"> |
|
| 806 | - <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle') . '</caption> |
|
| 804 | + <div id="' . $mapid.'-table-span" class="olPOItableSpan"> |
|
| 805 | + <table id="' . $mapid.'-table" class="olPOItable"> |
|
| 806 | + <caption class="olPOITblCaption">' . $this->getLang('olmapPOItitle').'</caption> |
|
| 807 | 807 | <thead class="olPOITblHeader"> |
| 808 | 808 | <tr> |
| 809 | 809 | <th class="rowId" scope="col">id</th> |
| 810 | - <th class="icon" scope="col">' . $this->getLang('olmapPOIicon') . '</th> |
|
| 811 | - <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle') . '">' |
|
| 812 | - . $this->getLang('olmapPOIlat') . '</th> |
|
| 813 | - <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle') . '">' |
|
| 814 | - . $this->getLang('olmapPOIlon') . '</th> |
|
| 815 | - <th class="txt" scope="col">' . $this->getLang('olmapPOItxt') . '</th> |
|
| 810 | + <th class="icon" scope="col">' . $this->getLang('olmapPOIicon').'</th> |
|
| 811 | + <th class="lat" scope="col" title="' . $this->getLang('olmapPOIlatTitle').'">' |
|
| 812 | + . $this->getLang('olmapPOIlat').'</th> |
|
| 813 | + <th class="lon" scope="col" title="' . $this->getLang('olmapPOIlonTitle').'">' |
|
| 814 | + . $this->getLang('olmapPOIlon').'</th> |
|
| 815 | + <th class="txt" scope="col">' . $this->getLang('olmapPOItxt').'</th> |
|
| 816 | 816 | </tr> |
| 817 | 817 | </thead>'; |
| 818 | - if($poitabledesc != '') { |
|
| 819 | - $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">' . $poitabledesc |
|
| 818 | + if ($poitabledesc != '') { |
|
| 819 | + $renderer->doc .= '<tfoot class="olPOITblFooter"><tr><td colspan="5">'.$poitabledesc |
|
| 820 | 820 | . '</td></tr></tfoot>'; |
| 821 | 821 | } |
| 822 | - $renderer->doc .= '<tbody class="olPOITblBody">' . $poitable . '</tbody> |
|
| 822 | + $renderer->doc .= '<tbody class="olPOITblBody">'.$poitable.'</tbody> |
|
| 823 | 823 | </table> |
| 824 | 824 | </div>'; |
| 825 | 825 | $renderer->doc .= "\n"; |
@@ -830,28 +830,28 @@ discard block |
||
| 830 | 830 | $renderer->doc .= '"></script>'; |
| 831 | 831 | $mapnumber++; |
| 832 | 832 | return true; |
| 833 | - } elseif($format == 'metadata') { |
|
| 834 | - if(!(($this->dflt ['lat'] == $mainLat) && ($this->dflt ['lon'] == $mainLon))) { |
|
| 833 | + } elseif ($format == 'metadata') { |
|
| 834 | + if (!(($this->dflt ['lat'] == $mainLat) && ($this->dflt ['lon'] == $mainLon))) { |
|
| 835 | 835 | // render geo metadata, unless they are the default |
| 836 | 836 | $renderer->meta ['geo'] ['lat'] = $mainLat; |
| 837 | 837 | $renderer->meta ['geo'] ['lon'] = $mainLon; |
| 838 | - if($geophp = plugin_load('helper', 'geophp')) { |
|
| 838 | + if ($geophp = plugin_load('helper', 'geophp')) { |
|
| 839 | 839 | // if we have the geoPHP helper, add the geohash |
| 840 | 840 | |
| 841 | 841 | // fails with older php versions.. |
| 842 | 842 | // $renderer->meta['geo']['geohash'] = (new Point($mainLon,$mainLat))->out('geohash'); |
| 843 | - $p = new Point ($mainLon, $mainLat); |
|
| 843 | + $p = new Point($mainLon, $mainLat); |
|
| 844 | 844 | $renderer->meta ['geo'] ['geohash'] = $p->out('geohash'); |
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - if(($this->getConf('enableA11y')) && (!empty ($_firstimage))) { |
|
| 848 | + if (($this->getConf('enableA11y')) && (!empty ($_firstimage))) { |
|
| 849 | 849 | // add map local image into relation/firstimage if not already filled and when it is a local image |
| 850 | 850 | |
| 851 | 851 | global $ID; |
| 852 | 852 | $rel = p_get_metadata($ID, 'relation', METADATA_RENDER_USING_CACHE); |
| 853 | 853 | // $img = $rel ['firstimage']; |
| 854 | - if(empty ($rel ['firstimage']) /* || $img == $_firstimage*/) { |
|
| 854 | + if (empty ($rel ['firstimage']) /* || $img == $_firstimage*/) { |
|
| 855 | 855 | //dbglog ( $_firstimage, |
| 856 | 856 | // 'olmap::render#rendering image relation metadata for _firstimage as $img was empty or same.' ); |
| 857 | 857 | // This seems to never work; the firstimage entry in the .meta file is empty |