Self-Host

To Self-host @ https://link.flossboxin.org.in
This commit is contained in:
vdbhb59 2025-02-21 21:50:36 +05:30
commit c9898cf261
95 changed files with 5217 additions and 0 deletions

View file

@ -0,0 +1,37 @@
<?php
require_once "engines/text/text.php";
class OSMRequest extends EngineRequest {
public function get_request_url() {
$query_encoded = str_replace("%22", "\"", urlencode($this->query));
$results = array();
// TODO allow the nominatim instance to be customised
$url = "https://nominatim.openstreetmap.org/search?q=$query_encoded&format=json";
return $url;
}
public function parse_results($response) {
$json_response = json_decode($response, true);
if (!$json_response)
return array();
$results = array();
foreach ($json_response as $item) {
array_push($results, array(
"title" => $item["name"],
"description" => $item["display_name"],
"url" => "https://www.openstreetmap.org/" . $item["osm_type"] . "/" . $item["osm_id"],
"base_url" => "www.openstreetmap.org"
));
}
return $results;
}
public static function print_results($results, $opts) {
TextSearch::print_results($results, $opts);
}
}
?>