From 8ad527cf77a2479623867d2bdae69a7057bd22db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phil=20H=C3=B6fer?= <phil@suma-ev.de> Date: Thu, 12 Jan 2017 09:05:07 +0100 Subject: [PATCH] =?UTF-8?q?dict.cc=20nur=20f=C3=BCr=20Suchen=20mit=20wenig?= =?UTF-8?q?er=20als=203=20W=C3=B6rtern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/MetaGerSearch.php | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index a8d1c9b75..bb5205935 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -166,19 +166,21 @@ class MetaGerSearch extends Controller $mquicktips = array_merge($mquicktips, $quicktips); # Dict.cc Quicktip - $url = "http://www.dict.cc/metager.php?s=" . urlencode($q); - $decodedResponse = json_decode($this->get($url), true); - if ($decodedResponse["headline"] != "" && $decodedResponse["link"] != "") { - $quicktip = []; - $quicktip["title"] = $decodedResponse["headline"]; - $quicktip["URL"] = $decodedResponse["link"]; - $quicktip["summary"] = implode(", ", $decodedResponse["translations"]); - $quicktip['gefVon'] = trans('metaGerSearch.quicktips.dictcc.adress'); - - if (App::isLocale('de')) { - array_unshift($mquicktips, $quicktip); - } else { - $mquicktips[] = $quicktip; + if (count(explode(' ', $q)) < 3) { + $url = "http://www.dict.cc/metager.php?s=" . urlencode($q); + $decodedResponse = json_decode($this->get($url), true); + if ($decodedResponse["headline"] != "" && $decodedResponse["link"] != "") { + $quicktip = []; + $quicktip["title"] = $decodedResponse["headline"]; + $quicktip["URL"] = $decodedResponse["link"]; + $quicktip["summary"] = implode(", ", $decodedResponse["translations"]); + $quicktip['gefVon'] = trans('metaGerSearch.quicktips.dictcc.adress'); + + if (App::isLocale('de')) { + array_unshift($mquicktips, $quicktip); + } else { + $mquicktips[] = $quicktip; + } } } -- GitLab