X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSearch.php;h=3c0ace3db5468d62486f7cfc2d1236a75b9b87c1;hb=16e1c8f893e74b644a0f5f2abe6e98f5f2d8abdc;hp=c41df70d9bf5f2db39cf2712a2cdf75fab3bc121;hpb=b3f9cef94a7be372428767125f85b7fec085b460;p=friendica.git diff --git a/src/Core/Search.php b/src/Core/Search.php index c41df70d9b..3c0ace3db5 100644 --- a/src/Core/Search.php +++ b/src/Core/Search.php @@ -1,6 +1,6 @@ isSuccess()) { $searchResult = json_decode($curlResult->getBody(), true); if (!empty($searchResult['profiles'])) { - $return = $searchResult['profiles']; + // Converting Directory Search results into contact-looking records + $return = array_map(function ($result) { + static $contactType = [ + 'People' => Contact::TYPE_PERSON, + 'Forum' => Contact::TYPE_COMMUNITY, + 'Organization' => Contact::TYPE_ORGANISATION, + 'News' => Contact::TYPE_NEWS, + ]; + + return [ + 'name' => $result['name'], + 'addr' => $result['addr'], + 'url' => $result['profile_url'], + 'network' => Protocol::DFRN, + 'micro' => $result['photo'], + 'contact-type' => $contactType[$result['account_type']], + ]; + }, $searchResult['profiles']); } } }