@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | final public function register(Doku_Event_Handler $controller): void { |
33 | 33 | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handleMetaheaderOutput'); |
34 | - if($this->getConf('toolbar_icon')) { |
|
34 | + if ($this->getConf('toolbar_icon')) { |
|
35 | 35 | $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insertButton', array()); |
36 | 36 | } |
37 | 37 | $controller->register_hook('PLUGIN_POPULARITY_DATA_SETUP', 'AFTER', $this, 'popularity'); |
@@ -58,20 +58,20 @@ discard block |
||
58 | 58 | $placename = $geotags ['placename'] ?? NULL; |
59 | 59 | $geohash = $geotags ['geohash'] ?? NULL; |
60 | 60 | |
61 | - if(!empty ($region)) { |
|
61 | + if (!empty ($region)) { |
|
62 | 62 | $event->data ['meta'] [] = array( |
63 | 63 | 'name' => 'geo.region', |
64 | 64 | 'content' => $region |
65 | 65 | ); |
66 | 66 | } |
67 | - if(!empty ($placename)) { |
|
67 | + if (!empty ($placename)) { |
|
68 | 68 | $event->data ['meta'] [] = array( |
69 | 69 | 'name' => 'geo.placename', |
70 | 70 | 'content' => $placename |
71 | 71 | ); |
72 | 72 | } |
73 | - if(!(empty ($lat) && empty ($lon))) { |
|
74 | - if(!empty ($alt)) { |
|
73 | + if (!(empty ($lat) && empty ($lon))) { |
|
74 | + if (!empty ($alt)) { |
|
75 | 75 | $event->data ['meta'] [] = array( |
76 | 76 | 'name' => 'geo.position', |
77 | 77 | 'content' => $lat . ';' . $lon . ';' . $alt |
@@ -83,20 +83,20 @@ discard block |
||
83 | 83 | ); |
84 | 84 | } |
85 | 85 | } |
86 | - if(!empty ($country)) { |
|
86 | + if (!empty ($country)) { |
|
87 | 87 | $event->data ['meta'] [] = array( |
88 | 88 | 'name' => 'geo.country', |
89 | 89 | 'content' => $country |
90 | 90 | ); |
91 | 91 | } |
92 | - if(!(empty ($lat) && empty ($lon))) { |
|
92 | + if (!(empty ($lat) && empty ($lon))) { |
|
93 | 93 | $event->data ['meta'] [] = array( |
94 | 94 | 'name' => "ICBM", |
95 | 95 | 'content' => $lat . ', ' . $lon |
96 | 96 | ); |
97 | 97 | // icbm is generally useless without a DC.title, |
98 | 98 | // so we copy that from title unless it's empty... |
99 | - if(!(empty ($title))) { |
|
99 | + if (!(empty ($title))) { |
|
100 | 100 | /* |
101 | 101 | * don't specify the DC namespace as this is incomplete; it should be done at the |
102 | 102 | * template level as it also needs a 'profile' attribute on the head/container, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ); |
111 | 111 | } |
112 | 112 | } |
113 | - if(!empty ($geohash)) { |
|
113 | + if (!empty ($geohash)) { |
|
114 | 114 | $event->data ['meta'] [] = array( |
115 | 115 | 'name' => 'geo.geohash', |
116 | 116 | 'content' => $geohash |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | preg_match("(hide|unhide)", $tags, $hide); |
75 | 75 | |
76 | 76 | $showlocation = $this->getConf('geotag_location_prefix'); |
77 | - if($this->getConf('geotag_showlocation')) { |
|
77 | + if ($this->getConf('geotag_showlocation')) { |
|
78 | 78 | $showlocation = trim(substr($placename [0], 10)); |
79 | - if($showlocation === '') { |
|
79 | + if ($showlocation === '') { |
|
80 | 80 | $showlocation = $this->getConf('geotag_location_prefix'); |
81 | 81 | } |
82 | 82 | } |
83 | 83 | // read config for system setting |
84 | 84 | $style = ''; |
85 | - if($this->getConf('geotag_hide')) { |
|
85 | + if ($this->getConf('geotag_hide')) { |
|
86 | 86 | $style = ' style="display: none;"'; |
87 | 87 | } |
88 | 88 | // override config for the current tag |
89 | - if(array_key_exists(0, $hide) && trim($hide [0]) === 'hide') { |
|
89 | + if (array_key_exists(0, $hide) && trim($hide [0]) === 'hide') { |
|
90 | 90 | $style = ' style="display: none;"'; |
91 | - } elseif(array_key_exists(0, $hide) && trim($hide [0]) === 'unhide') { |
|
91 | + } elseif (array_key_exists(0, $hide) && trim($hide [0]) === 'unhide') { |
|
92 | 92 | $style = ''; |
93 | 93 | } |
94 | 94 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param float $lon |
114 | 114 | */ |
115 | 115 | private function geohash(float $lat, float $lon) { |
116 | - if(!$geophp = plugin_load('helper', 'geophp')) { |
|
116 | + if (!$geophp = plugin_load('helper', 'geophp')) { |
|
117 | 117 | dbglog($geophp, 'syntax_plugin_geotag_geotag::geohash: geophp plugin is not available.'); |
118 | 118 | return ""; |
119 | 119 | } |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | * @see DokuWiki_Syntax_Plugin::render() |
127 | 127 | */ |
128 | 128 | final public function render($format, Doku_Renderer $renderer, $data): bool { |
129 | - if($data === false) { |
|
129 | + if ($data === false) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | [$lat, $lon, $alt, $geohash, $region, $placename, $country, $showlocation, $style] = $data; |
133 | 133 | $ddlat = $lat; |
134 | 134 | $ddlon = $lon; |
135 | - if($this->getConf('displayformat') === 'DMS') { |
|
135 | + if ($this->getConf('displayformat') === 'DMS') { |
|
136 | 136 | $lat = $this->convertLat($lat); |
137 | 137 | $lon = $this->convertLon($lon); |
138 | 138 | } else { |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | $lon .= 'º'; |
141 | 141 | } |
142 | 142 | |
143 | - if($format === 'xhtml') { |
|
144 | - if($this->getConf('geotag_prevent_microformat_render')) { |
|
143 | + if ($format === 'xhtml') { |
|
144 | + if ($this->getConf('geotag_prevent_microformat_render')) { |
|
145 | 145 | return true; |
146 | 146 | } |
147 | 147 | $searchPre = ''; |
148 | 148 | $searchPost = ''; |
149 | - if($this->getConf('geotag_showsearch')) { |
|
150 | - if($spHelper = plugin_load('helper', 'spatialhelper_search')) { |
|
149 | + if ($this->getConf('geotag_showsearch')) { |
|
150 | + if ($spHelper = plugin_load('helper', 'spatialhelper_search')) { |
|
151 | 151 | $title = $this->getLang('findnearby') . ' ' . $placename; |
152 | 152 | $url = wl( |
153 | 153 | getID(), array( |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | . $lat . '</span>;'; |
172 | 172 | $renderer->doc .= '<span class="p-longitude longitude" itemprop="longitude" data-longitude="' . $ddlon |
173 | 173 | . '">' . $lon . '</span>'; |
174 | - if(!empty ($alt)) { |
|
174 | + if (!empty ($alt)) { |
|
175 | 175 | $renderer->doc .= ', <span class="p-altitude altitude" itemprop="elevation" data-altitude="' . $alt |
176 | 176 | . '">' . $alt . 'm</span>'; |
177 | 177 | } |
178 | 178 | $renderer->doc .= '</span>' . $searchPost . '</div>' . DOKU_LF; |
179 | 179 | return true; |
180 | - } elseif($format === 'metadata') { |
|
180 | + } elseif ($format === 'metadata') { |
|
181 | 181 | // render metadata (our action plugin will put it in the page head) |
182 | 182 | $renderer->meta ['geo'] ['lat'] = $ddlat; |
183 | 183 | $renderer->meta ['geo'] ['lon'] = $ddlon; |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | $renderer->meta ['geo'] ['region'] = $region; |
186 | 186 | $renderer->meta ['geo'] ['country'] = $country; |
187 | 187 | $renderer->meta ['geo'] ['geohash'] = $geohash; |
188 | - if(!empty ($alt)) { |
|
188 | + if (!empty ($alt)) { |
|
189 | 189 | $renderer->meta ['geo'] ['alt'] = $alt; |
190 | 190 | } |
191 | 191 | return true; |
192 | - } elseif($format === 'odt') { |
|
193 | - if(!empty ($alt)) { |
|
192 | + } elseif ($format === 'odt') { |
|
193 | + if (!empty ($alt)) { |
|
194 | 194 | $alt = ', ' . $alt . 'm'; |
195 | 195 | } |
196 | 196 | $renderer->p_open(); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @todo move this into a shared library |
215 | 215 | */ |
216 | 216 | private function convertLat(float $decimaldegrees): string { |
217 | - if(strpos($decimaldegrees, '-') !== false) { |
|
217 | + if (strpos($decimaldegrees, '-') !== false) { |
|
218 | 218 | $latPos = "S"; |
219 | 219 | } else { |
220 | 220 | $latPos = "N"; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $secs = ($decimaldegrees - $dms) * 3600; |
236 | 236 | $min = floor($secs / 60); |
237 | 237 | $sec = round($secs - ($min * 60), 3); |
238 | - $dms .= 'º' . $min . '\'' . $sec . '"'; |
|
238 | + $dms .= 'º' . $min . '\'' . $sec . '"'; |
|
239 | 239 | return $dms; |
240 | 240 | } |
241 | 241 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @todo move this into a shared library |
248 | 248 | */ |
249 | 249 | private function convertLon(float $decimaldegrees): string { |
250 | - if(strpos($decimaldegrees, '-') !== false) { |
|
250 | + if (strpos($decimaldegrees, '-') !== false) { |
|
251 | 251 | $lonPos = "W"; |
252 | 252 | } else { |
253 | 253 | $lonPos = "E"; |