From 68ca56471a86cb80373634cd697b06ba4579d232 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 21 Jun 2015 02:02:16 +0200 Subject: [PATCH] delete test file --- geocoordinates/test.php | 69 ----------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 geocoordinates/test.php diff --git a/geocoordinates/test.php b/geocoordinates/test.php deleted file mode 100644 index a215522a..00000000 --- a/geocoordinates/test.php +++ /dev/null @@ -1,69 +0,0 @@ -set_baseurl(get_config('system','url')); - -require_once("addon/geocoordinates/geocoordinates.php"); - -function geocoordinates_resolve_item2(&$item) { - if((!$item["coord"]) || ($item["location"])) - return; - - $key = get_config("geocoordinates", "api_key"); - if ($key == "") - return; - - $language = get_config("geocoordinates", "language"); - if ($language == "") - $language = "de"; - - $result = Cache::get("geocoordinates:".$language.":".$item["coord"]); - if (!is_null($result)) { - $item["location"] = $result; - return; - } - - $coords = explode(' ',$item["coord"]); - - $s = fetch_url("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language); - - if (!$s) { - logger("API could not be queried", LOGGER_DEBUG); - return; - } - - $data = json_decode($s); - - if ($data->status->code != "200") { - logger("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG); - return; - } - - if (($data->total_results == 0) OR (count($data->results) == 0)) { - logger("No results found", LOGGER_DEBUG); - return; - } - - $item["location"] = $data->results[0]->formatted; - - Cache::set("geocoordinates:".$language.":".$item["coord"], $item["location"]); - -} - -$r = q("SELECT coord, location FROM item WHERE guid='stat1721635584fdaf31b19541063667' LIMIT 1"); -$item = $r[0]; -geocoordinates_resolve_item2($item); -print_r($item); -?> -- 2.39.5