Completed
Pull Request — master (#47)
by
unknown
14s
created
action.php 1 patch
Indentation   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -28,379 +28,379 @@
 block discarded – undo
28 28
  */
29 29
 class action_plugin_spatialhelper extends ActionPlugin
30 30
 {
31
-    /**
32
-     * Register for events.
33
-     *
34
-     * @param EventHandler $controller
35
-     *          DokuWiki's event controller object. Also available as global $EVENT_HANDLER
36
-     */
37
-    public function register(EventHandler $controller): void
38
-    {
39
-        // listen for page add / delete events
40
-        // http://www.dokuwiki.org/devel:event:indexer_page_add
41
-        $controller->register_hook('INDEXER_PAGE_ADD', 'BEFORE', $this, 'handleIndexerPageAdd');
42
-        $controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'removeFromIndex');
31
+	/**
32
+	 * Register for events.
33
+	 *
34
+	 * @param EventHandler $controller
35
+	 *          DokuWiki's event controller object. Also available as global $EVENT_HANDLER
36
+	 */
37
+	public function register(EventHandler $controller): void
38
+	{
39
+		// listen for page add / delete events
40
+		// http://www.dokuwiki.org/devel:event:indexer_page_add
41
+		$controller->register_hook('INDEXER_PAGE_ADD', 'BEFORE', $this, 'handleIndexerPageAdd');
42
+		$controller->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'removeFromIndex');
43 43
 
44
-        // http://www.dokuwiki.org/devel:event:sitemap_generate
45
-        $controller->register_hook('SITEMAP_GENERATE', 'BEFORE', $this, 'handleSitemapGenerateBefore');
46
-        // using after will only trigger us if a sitemap was actually created
47
-        $controller->register_hook('SITEMAP_GENERATE', 'AFTER', $this, 'handleSitemapGenerateAfter');
44
+		// http://www.dokuwiki.org/devel:event:sitemap_generate
45
+		$controller->register_hook('SITEMAP_GENERATE', 'BEFORE', $this, 'handleSitemapGenerateBefore');
46
+		// using after will only trigger us if a sitemap was actually created
47
+		$controller->register_hook('SITEMAP_GENERATE', 'AFTER', $this, 'handleSitemapGenerateAfter');
48 48
 
49
-        // handle actions we know of
50
-        $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleActionActPreprocess', []);
51
-        // handle HTML eg. /dokuwiki/doku.php?id=start&do=findnearby&geohash=u15vk4
52
-        $controller->register_hook(
53
-            'TPL_ACT_UNKNOWN',
54
-            'BEFORE',
55
-            $this,
56
-            'findnearby',
57
-            ['format' => 'HTML']
58
-        );
59
-        // handles AJAX/json eg: jQuery.post("/dokuwiki/lib/exe/ajax.php?id=start&call=findnearby&geohash=u15vk4");
60
-        $controller->register_hook(
61
-            'AJAX_CALL_UNKNOWN',
62
-            'BEFORE',
63
-            $this,
64
-            'findnearby',
65
-            ['format' => 'JSON']
66
-        );
49
+		// handle actions we know of
50
+		$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleActionActPreprocess', []);
51
+		// handle HTML eg. /dokuwiki/doku.php?id=start&do=findnearby&geohash=u15vk4
52
+		$controller->register_hook(
53
+			'TPL_ACT_UNKNOWN',
54
+			'BEFORE',
55
+			$this,
56
+			'findnearby',
57
+			['format' => 'HTML']
58
+		);
59
+		// handles AJAX/json eg: jQuery.post("/dokuwiki/lib/exe/ajax.php?id=start&call=findnearby&geohash=u15vk4");
60
+		$controller->register_hook(
61
+			'AJAX_CALL_UNKNOWN',
62
+			'BEFORE',
63
+			$this,
64
+			'findnearby',
65
+			['format' => 'JSON']
66
+		);
67 67
 
68
-        // listen for media uploads and deletes
69
-        $controller->register_hook('MEDIA_UPLOAD_FINISH', 'BEFORE', $this, 'handleMediaUploaded', []);
70
-        $controller->register_hook('MEDIA_DELETE_FILE', 'BEFORE', $this, 'handleMediaDeleted', []);
68
+		// listen for media uploads and deletes
69
+		$controller->register_hook('MEDIA_UPLOAD_FINISH', 'BEFORE', $this, 'handleMediaUploaded', []);
70
+		$controller->register_hook('MEDIA_DELETE_FILE', 'BEFORE', $this, 'handleMediaDeleted', []);
71 71
 
72
-        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handleMetaheaderOutput');
73
-        $controller->register_hook('PLUGIN_POPULARITY_DATA_SETUP', 'AFTER', $this, 'popularity');
74
-    }
72
+		$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handleMetaheaderOutput');
73
+		$controller->register_hook('PLUGIN_POPULARITY_DATA_SETUP', 'AFTER', $this, 'popularity');
74
+	}
75 75
 
76
-    /**
77
-     * Update the spatial index for the page.
78
-     *
79
-     * @param Event $event
80
-     *          event object
81
-     * @param mixed $param
82
-     *          the parameters passed to register_hook when this handler was registered
83
-     */
84
-    public function handleIndexerPageAdd(Event $event, $param): void
85
-    {
86
-        // $event→data['page'] – the page id
87
-        // $event→data['body'] – empty, can be filled by additional content to index by your plugin
88
-        // $event→data['metadata'] – the metadata that shall be indexed. This is an array where the keys are the
89
-        //    metadata indexes and the value a string or an array of strings with the values.
90
-        //    title and relation_references will already be set.
91
-        $id = $event->data ['page'];
92
-        $indexer = plugin_load('helper', 'spatialhelper_index');
93
-        $indexer->updateSpatialIndex($id);
94
-    }
76
+	/**
77
+	 * Update the spatial index for the page.
78
+	 *
79
+	 * @param Event $event
80
+	 *          event object
81
+	 * @param mixed $param
82
+	 *          the parameters passed to register_hook when this handler was registered
83
+	 */
84
+	public function handleIndexerPageAdd(Event $event, $param): void
85
+	{
86
+		// $event→data['page'] – the page id
87
+		// $event→data['body'] – empty, can be filled by additional content to index by your plugin
88
+		// $event→data['metadata'] – the metadata that shall be indexed. This is an array where the keys are the
89
+		//    metadata indexes and the value a string or an array of strings with the values.
90
+		//    title and relation_references will already be set.
91
+		$id = $event->data ['page'];
92
+		$indexer = plugin_load('helper', 'spatialhelper_index');
93
+		$indexer->updateSpatialIndex($id);
94
+	}
95 95
 
96
-    /**
97
-     * Update the spatial index, removing the page.
98
-     *
99
-     * @param Event $event
100
-     *          event object
101
-     * @param mixed $param
102
-     *          the parameters passed to register_hook when this handler was registered
103
-     */
104
-    public function removeFromIndex(Event $event, $param): void
105
-    {
106
-        // event data:
107
-        // $data[0] – The raw arguments for io_saveFile as an array. Do not change file path.
108
-        // $data[0][0] – the file path.
109
-        // $data[0][1] – the content to be saved, and may be modified.
110
-        // $data[1] – ns: The colon separated namespace path minus the trailing page name. (false if root ns)
111
-        // $data[2] – page_name: The wiki page name.
112
-        // $data[3] – rev: The page revision, false for current wiki pages.
96
+	/**
97
+	 * Update the spatial index, removing the page.
98
+	 *
99
+	 * @param Event $event
100
+	 *          event object
101
+	 * @param mixed $param
102
+	 *          the parameters passed to register_hook when this handler was registered
103
+	 */
104
+	public function removeFromIndex(Event $event, $param): void
105
+	{
106
+		// event data:
107
+		// $data[0] – The raw arguments for io_saveFile as an array. Do not change file path.
108
+		// $data[0][0] – the file path.
109
+		// $data[0][1] – the content to be saved, and may be modified.
110
+		// $data[1] – ns: The colon separated namespace path minus the trailing page name. (false if root ns)
111
+		// $data[2] – page_name: The wiki page name.
112
+		// $data[3] – rev: The page revision, false for current wiki pages.
113 113
 
114
-        dbglog($event->data, "Event data in removeFromIndex.");
115
-        if (@file_exists($event->data [0] [0])) {
116
-            // file not new
117
-            if (!$event->data [0] [1]) {
118
-                // file is empty, page is being deleted
119
-                if (empty($event->data [1])) {
120
-                    // root namespace
121
-                    $id = $event->data [2];
122
-                } else {
123
-                    $id = $event->data [1] . ":" . $event->data [2];
124
-                }
125
-                $indexer = plugin_load('helper', 'spatialhelper_index');
126
-                if ($indexer !== null) {
127
-                    $indexer->deleteFromIndex($id);
128
-                }
129
-            }
130
-        }
131
-    }
114
+		dbglog($event->data, "Event data in removeFromIndex.");
115
+		if (@file_exists($event->data [0] [0])) {
116
+			// file not new
117
+			if (!$event->data [0] [1]) {
118
+				// file is empty, page is being deleted
119
+				if (empty($event->data [1])) {
120
+					// root namespace
121
+					$id = $event->data [2];
122
+				} else {
123
+					$id = $event->data [1] . ":" . $event->data [2];
124
+				}
125
+				$indexer = plugin_load('helper', 'spatialhelper_index');
126
+				if ($indexer !== null) {
127
+					$indexer->deleteFromIndex($id);
128
+				}
129
+			}
130
+		}
131
+	}
132 132
 
133
-    /**
134
-     * Add a new SitemapItem object that points to the KML of public geocoded pages.
135
-     *
136
-     * @param Event $event
137
-     * @param mixed $param
138
-     */
139
-    public function handleSitemapGenerateBefore(Event $event, $param): void
140
-    {
141
-        $path = mediaFN($this->getConf('media_kml'));
142
-        $lastmod = @filemtime($path);
143
-        $event->data ['items'] [] = new Item(ml($this->getConf('media_kml'), '', true, '&', true), $lastmod);
144
-    }
133
+	/**
134
+	 * Add a new SitemapItem object that points to the KML of public geocoded pages.
135
+	 *
136
+	 * @param Event $event
137
+	 * @param mixed $param
138
+	 */
139
+	public function handleSitemapGenerateBefore(Event $event, $param): void
140
+	{
141
+		$path = mediaFN($this->getConf('media_kml'));
142
+		$lastmod = @filemtime($path);
143
+		$event->data ['items'] [] = new Item(ml($this->getConf('media_kml'), '', true, '&', true), $lastmod);
144
+	}
145 145
 
146
-    /**
147
-     * Create a spatial sitemap or attach the geo/kml map to the sitemap.
148
-     *
149
-     * @param Event $event
150
-     *          event object, not used
151
-     * @param mixed $param
152
-     *          parameter array, not used
153
-     */
154
-    public function handleSitemapGenerateAfter(Event $event, $param): bool
155
-    {
156
-        // $event→data['items']: Array of SitemapItem instances, the array of sitemap items that already
157
-        //      contains all public pages of the wiki
158
-        // $event→data['sitemap']: The path of the file the sitemap will be saved to.
159
-        if (($helper = plugin_load('helper', 'spatialhelper_sitemap')) !== null) {
160
-            // dbglog($helper, "createSpatialSitemap loaded helper.");
146
+	/**
147
+	 * Create a spatial sitemap or attach the geo/kml map to the sitemap.
148
+	 *
149
+	 * @param Event $event
150
+	 *          event object, not used
151
+	 * @param mixed $param
152
+	 *          parameter array, not used
153
+	 */
154
+	public function handleSitemapGenerateAfter(Event $event, $param): bool
155
+	{
156
+		// $event→data['items']: Array of SitemapItem instances, the array of sitemap items that already
157
+		//      contains all public pages of the wiki
158
+		// $event→data['sitemap']: The path of the file the sitemap will be saved to.
159
+		if (($helper = plugin_load('helper', 'spatialhelper_sitemap')) !== null) {
160
+			// dbglog($helper, "createSpatialSitemap loaded helper.");
161 161
 
162
-            $kml = $helper->createKMLSitemap($this->getConf('media_kml'));
163
-            $rss = $helper->createGeoRSSSitemap($this->getConf('media_georss'));
162
+			$kml = $helper->createKMLSitemap($this->getConf('media_kml'));
163
+			$rss = $helper->createGeoRSSSitemap($this->getConf('media_georss'));
164 164
 
165
-            if (!empty($this->getConf('sitemap_namespaces'))) {
166
-                $namespaces = array_map('trim', explode("\n", $this->getConf('sitemap_namespaces')));
167
-                foreach ($namespaces as $namespace) {
168
-                    $kmlN = $helper->createKMLSitemap($namespace . $this->getConf('media_kml'));
169
-                    $rssN = $helper->createGeoRSSSitemap($namespace . $this->getConf('media_georss'));
170
-                    dbglog(
171
-                        $kmlN && $rssN,
172
-                        "handleSitemapGenerateAfter, created KML / GeoRSS sitemap in $namespace, succes: "
173
-                    );
174
-                }
175
-            }
176
-            return $kml && $rss;
177
-        }
178
-    }
165
+			if (!empty($this->getConf('sitemap_namespaces'))) {
166
+				$namespaces = array_map('trim', explode("\n", $this->getConf('sitemap_namespaces')));
167
+				foreach ($namespaces as $namespace) {
168
+					$kmlN = $helper->createKMLSitemap($namespace . $this->getConf('media_kml'));
169
+					$rssN = $helper->createGeoRSSSitemap($namespace . $this->getConf('media_georss'));
170
+					dbglog(
171
+						$kmlN && $rssN,
172
+						"handleSitemapGenerateAfter, created KML / GeoRSS sitemap in $namespace, succes: "
173
+					);
174
+				}
175
+			}
176
+			return $kml && $rss;
177
+		}
178
+	}
179 179
 
180
-    /**
181
-     * trap findnearby action.
182
-     * This addional handler is required as described at: https://www.dokuwiki.org/devel:event:tpl_act_unknown
183
-     *
184
-     * @param Event $event
185
-     *          event object
186
-     * @param mixed $param
187
-     *          not used
188
-     */
189
-    public function handleActionActPreprocess(Event $event, $param): void
190
-    {
191
-        if ($event->data !== 'findnearby') {
192
-            return;
193
-        }
194
-        $event->preventDefault();
195
-    }
180
+	/**
181
+	 * trap findnearby action.
182
+	 * This addional handler is required as described at: https://www.dokuwiki.org/devel:event:tpl_act_unknown
183
+	 *
184
+	 * @param Event $event
185
+	 *          event object
186
+	 * @param mixed $param
187
+	 *          not used
188
+	 */
189
+	public function handleActionActPreprocess(Event $event, $param): void
190
+	{
191
+		if ($event->data !== 'findnearby') {
192
+			return;
193
+		}
194
+		$event->preventDefault();
195
+	}
196 196
 
197
-    /**
198
-     * handle findnearby action.
199
-     *
200
-     * @param Event $event
201
-     *          event object
202
-     * @param mixed $param
203
-     *          associative array with keys
204
-     *          'format'=> HTML | JSON
205
-     */
206
-    public function findnearby(Event $event, $param): void
207
-    {
208
-        if ($event->data !== 'findnearby') {
209
-            return;
210
-        }
211
-        $event->preventDefault();
212
-        $results = [];
213
-        global $INPUT;
214
-        if (($helper = plugin_load('helper', 'spatialhelper_search')) !== null) {
215
-            if ($INPUT->has('lat') && $INPUT->has('lon')) {
216
-                $results = $helper->findNearbyLatLon($INPUT->param('lat'), $INPUT->param('lon'));
217
-            } elseif ($INPUT->has('geohash')) {
218
-                $results = $helper->findNearby($INPUT->str('geohash'));
219
-            } else {
220
-                $results = ['error' => hsc($this->getLang('invalidinput'))];
221
-            }
222
-        }
197
+	/**
198
+	 * handle findnearby action.
199
+	 *
200
+	 * @param Event $event
201
+	 *          event object
202
+	 * @param mixed $param
203
+	 *          associative array with keys
204
+	 *          'format'=> HTML | JSON
205
+	 */
206
+	public function findnearby(Event $event, $param): void
207
+	{
208
+		if ($event->data !== 'findnearby') {
209
+			return;
210
+		}
211
+		$event->preventDefault();
212
+		$results = [];
213
+		global $INPUT;
214
+		if (($helper = plugin_load('helper', 'spatialhelper_search')) !== null) {
215
+			if ($INPUT->has('lat') && $INPUT->has('lon')) {
216
+				$results = $helper->findNearbyLatLon($INPUT->param('lat'), $INPUT->param('lon'));
217
+			} elseif ($INPUT->has('geohash')) {
218
+				$results = $helper->findNearby($INPUT->str('geohash'));
219
+			} else {
220
+				$results = ['error' => hsc($this->getLang('invalidinput'))];
221
+			}
222
+		}
223 223
 
224
-        $showMedia = $INPUT->bool('showMedia', true);
224
+		$showMedia = $INPUT->bool('showMedia', true);
225 225
 
226
-        switch ($param['format']) {
227
-            case 'JSON':
228
-                $this->printJSON($results);
229
-                break;
230
-            case 'HTML':
231
-                // fall through to default
232
-            default:
233
-                $this->printHTML($results, $showMedia);
234
-                break;
235
-        }
236
-    }
226
+		switch ($param['format']) {
227
+			case 'JSON':
228
+				$this->printJSON($results);
229
+				break;
230
+			case 'HTML':
231
+				// fall through to default
232
+			default:
233
+				$this->printHTML($results, $showMedia);
234
+				break;
235
+		}
236
+	}
237 237
 
238
-    /**
239
-     * Print seachresults as HTML lists.
240
-     *
241
-     * @param array $searchresults
242
-     */
243
-    private function printJSON(array $searchresults): void
244
-    {
245
-        require_once DOKU_INC . 'inc/JSON.php';
246
-        $json = new JSON();
247
-        header('Content-Type: application/json');
248
-        echo $json->encode($searchresults);
249
-    }
238
+	/**
239
+	 * Print seachresults as HTML lists.
240
+	 *
241
+	 * @param array $searchresults
242
+	 */
243
+	private function printJSON(array $searchresults): void
244
+	{
245
+		require_once DOKU_INC . 'inc/JSON.php';
246
+		$json = new JSON();
247
+		header('Content-Type: application/json');
248
+		echo $json->encode($searchresults);
249
+	}
250 250
 
251
-    /**
252
-     * Print seachresults as HTML lists.
253
-     *
254
-     * @param array $searchresults
255
-     * @param bool $showMedia
256
-     */
257
-    private function printHTML(array $searchresults, bool $showMedia = true): void
258
-    {
259
-        $pages = (array)($searchresults ['pages']);
260
-        $media = (array)$searchresults ['media'];
261
-        $lat = (float)$searchresults ['lat'];
262
-        $lon = (float)$searchresults ['lon'];
263
-        $geohash = (string)$searchresults ['geohash'];
251
+	/**
252
+	 * Print seachresults as HTML lists.
253
+	 *
254
+	 * @param array $searchresults
255
+	 * @param bool $showMedia
256
+	 */
257
+	private function printHTML(array $searchresults, bool $showMedia = true): void
258
+	{
259
+		$pages = (array)($searchresults ['pages']);
260
+		$media = (array)$searchresults ['media'];
261
+		$lat = (float)$searchresults ['lat'];
262
+		$lon = (float)$searchresults ['lon'];
263
+		$geohash = (string)$searchresults ['geohash'];
264 264
 
265
-        if (isset($searchresults ['error'])) {
266
-            echo '<div class="level1"><p>' . hsc($searchresults ['error']) . '</p></div>';
267
-            return;
268
-        }
265
+		if (isset($searchresults ['error'])) {
266
+			echo '<div class="level1"><p>' . hsc($searchresults ['error']) . '</p></div>';
267
+			return;
268
+		}
269 269
 
270
-        // print a HTML list
271
-        echo '<h1>' . $this->getLang('results_header') . '</h1>' . DOKU_LF;
272
-        echo '<div class="level1">' . DOKU_LF;
273
-        if ($pages !== []) {
274
-            $pagelist = '<ol>' . DOKU_LF;
275
-            foreach ($pages as $page) {
276
-                $pagelist .= '<li>' . html_wikilink(
277
-                    ':' . $page ['id'],
278
-                    useHeading('navigation') ? null :
279
-                        noNS($page ['id'])
280
-                ) . ' (' . $this->getLang('results_distance_prefix')
281
-                    . $page ['distance'] . '&nbsp;m) ' . $page ['description'] . '</li>' . DOKU_LF;
282
-            }
283
-            $pagelist .= '</ol>' . DOKU_LF;
270
+		// print a HTML list
271
+		echo '<h1>' . $this->getLang('results_header') . '</h1>' . DOKU_LF;
272
+		echo '<div class="level1">' . DOKU_LF;
273
+		if ($pages !== []) {
274
+			$pagelist = '<ol>' . DOKU_LF;
275
+			foreach ($pages as $page) {
276
+				$pagelist .= '<li>' . html_wikilink(
277
+					':' . $page ['id'],
278
+					useHeading('navigation') ? null :
279
+						noNS($page ['id'])
280
+				) . ' (' . $this->getLang('results_distance_prefix')
281
+					. $page ['distance'] . '&nbsp;m) ' . $page ['description'] . '</li>' . DOKU_LF;
282
+			}
283
+			$pagelist .= '</ol>' . DOKU_LF;
284 284
 
285
-            echo '<h2>' . $this->getLang('results_pages') . hsc(
286
-                ' lat;lon: ' . $lat . ';' . $lon
287
-                    . ' (geohash: ' . $geohash . ')'
288
-            ) . '</h2>';
289
-            echo '<div class="level2">' . DOKU_LF;
290
-            echo $pagelist;
291
-            echo '</div>' . DOKU_LF;
292
-        } else {
293
-            echo '<p>' . hsc($this->getLang('nothingfound')) . '</p>';
294
-        }
285
+			echo '<h2>' . $this->getLang('results_pages') . hsc(
286
+				' lat;lon: ' . $lat . ';' . $lon
287
+					. ' (geohash: ' . $geohash . ')'
288
+			) . '</h2>';
289
+			echo '<div class="level2">' . DOKU_LF;
290
+			echo $pagelist;
291
+			echo '</div>' . DOKU_LF;
292
+		} else {
293
+			echo '<p>' . hsc($this->getLang('nothingfound')) . '</p>';
294
+		}
295 295
 
296
-        if ($media !== [] && $showMedia) {
297
-            $pagelist = '<ol>' . DOKU_LF;
298
-            foreach ($media as $m) {
299
-                $opts = [];
300
-                $link = ml($m ['id'], $opts, false, '&amp;', false);
301
-                $opts ['w'] = '100';
302
-                $src = ml($m ['id'], $opts);
303
-                $pagelist .= '<li><a href="' . $link . '"><img src="' . $src . '"></a> ('
304
-                    . $this->getLang('results_distance_prefix') . $page ['distance'] . '&nbsp;m) ' . hsc($desc)
305
-                    . '</li>' . DOKU_LF;
306
-            }
307
-            $pagelist .= '</ol>' . DOKU_LF;
296
+		if ($media !== [] && $showMedia) {
297
+			$pagelist = '<ol>' . DOKU_LF;
298
+			foreach ($media as $m) {
299
+				$opts = [];
300
+				$link = ml($m ['id'], $opts, false, '&amp;', false);
301
+				$opts ['w'] = '100';
302
+				$src = ml($m ['id'], $opts);
303
+				$pagelist .= '<li><a href="' . $link . '"><img src="' . $src . '"></a> ('
304
+					. $this->getLang('results_distance_prefix') . $page ['distance'] . '&nbsp;m) ' . hsc($desc)
305
+					. '</li>' . DOKU_LF;
306
+			}
307
+			$pagelist .= '</ol>' . DOKU_LF;
308 308
 
309
-            echo '<h2>' . $this->getLang('results_media') . hsc(
310
-                ' lat;lon: ' . $lat . ';' . $lon
311
-                    . ' (geohash: ' . $geohash . ')'
312
-            ) . '</h2>' . DOKU_LF;
313
-            echo '<div class="level2">' . DOKU_LF;
314
-            echo $pagelist;
315
-            echo '</div>' . DOKU_LF;
316
-        }
317
-        echo '<p>' . $this->getLang('results_precision') . $searchresults ['precision'] . ' m. ';
318
-        if (strlen($geohash) > 1) {
319
-            $url = wl(
320
-                getID(),
321
-                ['do' => 'findnearby', 'geohash' => substr($geohash, 0, -1)]
322
-            );
323
-            echo '<a href="' . $url . '" class="findnearby">' . $this->getLang('search_largerarea') . '</a>.</p>'
324
-                . DOKU_LF;
325
-        }
326
-        echo '</div>' . DOKU_LF;
327
-    }
309
+			echo '<h2>' . $this->getLang('results_media') . hsc(
310
+				' lat;lon: ' . $lat . ';' . $lon
311
+					. ' (geohash: ' . $geohash . ')'
312
+			) . '</h2>' . DOKU_LF;
313
+			echo '<div class="level2">' . DOKU_LF;
314
+			echo $pagelist;
315
+			echo '</div>' . DOKU_LF;
316
+		}
317
+		echo '<p>' . $this->getLang('results_precision') . $searchresults ['precision'] . ' m. ';
318
+		if (strlen($geohash) > 1) {
319
+			$url = wl(
320
+				getID(),
321
+				['do' => 'findnearby', 'geohash' => substr($geohash, 0, -1)]
322
+			);
323
+			echo '<a href="' . $url . '" class="findnearby">' . $this->getLang('search_largerarea') . '</a>.</p>'
324
+				. DOKU_LF;
325
+		}
326
+		echo '</div>' . DOKU_LF;
327
+	}
328 328
 
329
-    /**
330
-     * add media to spatial index.
331
-     *
332
-     * @param Event $event
333
-     * @param mixed $param
334
-     */
335
-    public function handleMediaUploaded(Event $event, $param): void
336
-    {
337
-        // data[0] temporary file name (read from $_FILES)
338
-        // data[1] file name of the file being uploaded
339
-        // data[2] future directory id of the file being uploaded
340
-        // data[3] the mime type of the file being uploaded
341
-        // data[4] true if the uploaded file exists already
342
-        // data[5] (since 2011-02-06) the PHP function used to move the file to the correct location
329
+	/**
330
+	 * add media to spatial index.
331
+	 *
332
+	 * @param Event $event
333
+	 * @param mixed $param
334
+	 */
335
+	public function handleMediaUploaded(Event $event, $param): void
336
+	{
337
+		// data[0] temporary file name (read from $_FILES)
338
+		// data[1] file name of the file being uploaded
339
+		// data[2] future directory id of the file being uploaded
340
+		// data[3] the mime type of the file being uploaded
341
+		// data[4] true if the uploaded file exists already
342
+		// data[5] (since 2011-02-06) the PHP function used to move the file to the correct location
343 343
 
344
-        dbglog($event->data, "handleMediaUploaded::event data");
344
+		dbglog($event->data, "handleMediaUploaded::event data");
345 345
 
346
-        // check the list of mimetypes
347
-        // if it's a supported type call appropriate index function
348
-        if (substr_compare($event->data [3], 'image/jpeg', 0)) {
349
-            $indexer = plugin_load('helper', 'spatialhelper_index');
350
-            if ($indexer !== null) {
351
-                $indexer->indexImage($event->data [2]);
352
-            }
353
-        }
354
-        // TODO add image/tiff
355
-        // TODO kml, gpx, geojson...
356
-    }
346
+		// check the list of mimetypes
347
+		// if it's a supported type call appropriate index function
348
+		if (substr_compare($event->data [3], 'image/jpeg', 0)) {
349
+			$indexer = plugin_load('helper', 'spatialhelper_index');
350
+			if ($indexer !== null) {
351
+				$indexer->indexImage($event->data [2]);
352
+			}
353
+		}
354
+		// TODO add image/tiff
355
+		// TODO kml, gpx, geojson...
356
+	}
357 357
 
358
-    /**
359
-     * removes the media from the index.
360
-     */
361
-    public function handleMediaDeleted(Event $event, $param): void
362
-    {
363
-        // data['id'] ID data['unl'] unlink return code
364
-        // data['del'] Namespace directory unlink return code
365
-        // data['name'] file name data['path'] full path to the file
366
-        // data['size'] file size
358
+	/**
359
+	 * removes the media from the index.
360
+	 */
361
+	public function handleMediaDeleted(Event $event, $param): void
362
+	{
363
+		// data['id'] ID data['unl'] unlink return code
364
+		// data['del'] Namespace directory unlink return code
365
+		// data['name'] file name data['path'] full path to the file
366
+		// data['size'] file size
367 367
 
368
-        // remove the media id from the index
369
-        $indexer = plugin_load('helper', 'spatialhelper_index');
370
-        if ($indexer !== null) {
371
-            $indexer->deleteFromIndex('media__' . $event->data ['id']);
372
-        }
373
-    }
368
+		// remove the media id from the index
369
+		$indexer = plugin_load('helper', 'spatialhelper_index');
370
+		if ($indexer !== null) {
371
+			$indexer->deleteFromIndex('media__' . $event->data ['id']);
372
+		}
373
+	}
374 374
 
375
-    /**
376
-     * add a link to the spatial sitemap files in the header.
377
-     *
378
-     * @param Event $event
379
-     *          the DokuWiki event. $event->data is a two-dimensional
380
-     *          array of all meta headers. The keys are meta, link and script.
381
-     * @param mixed $param
382
-     *
383
-     * @see http://www.dokuwiki.org/devel:event:tpl_metaheader_output
384
-     */
385
-    public function handleMetaheaderOutput(Event $event, $param): void
386
-    {
387
-        // TODO maybe test for exist
388
-        $event->data ["link"] [] = ["type" => "application/atom+xml", "rel" => "alternate", "href" => ml($this->getConf('media_georss')), "title" => "Spatial ATOM Feed"];
389
-        $event->data ["link"] [] = ["type" => "application/vnd.google-earth.kml+xml", "rel" => "alternate", "href" => ml($this->getConf('media_kml')), "title" => "KML Sitemap"];
390
-    }
375
+	/**
376
+	 * add a link to the spatial sitemap files in the header.
377
+	 *
378
+	 * @param Event $event
379
+	 *          the DokuWiki event. $event->data is a two-dimensional
380
+	 *          array of all meta headers. The keys are meta, link and script.
381
+	 * @param mixed $param
382
+	 *
383
+	 * @see http://www.dokuwiki.org/devel:event:tpl_metaheader_output
384
+	 */
385
+	public function handleMetaheaderOutput(Event $event, $param): void
386
+	{
387
+		// TODO maybe test for exist
388
+		$event->data ["link"] [] = ["type" => "application/atom+xml", "rel" => "alternate", "href" => ml($this->getConf('media_georss')), "title" => "Spatial ATOM Feed"];
389
+		$event->data ["link"] [] = ["type" => "application/vnd.google-earth.kml+xml", "rel" => "alternate", "href" => ml($this->getConf('media_kml')), "title" => "KML Sitemap"];
390
+	}
391 391
 
392
-    /**
393
-     * Add spatialhelper popularity data.
394
-     *
395
-     * @param Event $event
396
-     *          the DokuWiki event
397
-     */
398
-    final public function popularity(Event $event): void
399
-    {
400
-        $versionInfo = getVersionData();
401
-        $plugin_info = $this->getInfo();
402
-        $event->data['spatialhelper']['version'] = $plugin_info['date'];
403
-        $event->data['spatialhelper']['dwversion'] = $versionInfo['date'];
404
-        $event->data['spatialhelper']['combinedversion'] = $versionInfo['date'] . '_' . $plugin_info['date'];
405
-    }
392
+	/**
393
+	 * Add spatialhelper popularity data.
394
+	 *
395
+	 * @param Event $event
396
+	 *          the DokuWiki event
397
+	 */
398
+	final public function popularity(Event $event): void
399
+	{
400
+		$versionInfo = getVersionData();
401
+		$plugin_info = $this->getInfo();
402
+		$event->data['spatialhelper']['version'] = $plugin_info['date'];
403
+		$event->data['spatialhelper']['dwversion'] = $versionInfo['date'];
404
+		$event->data['spatialhelper']['combinedversion'] = $versionInfo['date'] . '_' . $plugin_info['date'];
405
+	}
406 406
 }
Please login to merge, or discard this patch.