From 3072d67a50f0d694f0b4b3f734b88b11c8765cc1 Mon Sep 17 00:00:00 2001 From: Aria <aria@suma-ev.de> Date: Thu, 17 Aug 2017 11:28:46 +0200 Subject: [PATCH] sollte subcollection snicht ions nicht vorhanden seien wird stattdessen minism ausgegeben --- app/Models/parserSkripte/Minisucher.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/Models/parserSkripte/Minisucher.php b/app/Models/parserSkripte/Minisucher.php index 59689019e..37b0bb287 100644 --- a/app/Models/parserSkripte/Minisucher.php +++ b/app/Models/parserSkripte/Minisucher.php @@ -37,6 +37,7 @@ class Minisucher extends Searchengine try { $counter++; $result = simplexml_load_string($result->saveXML()); + $title = $result->xpath('//doc/arr[@name="title"]/str')[0]->__toString(); $link = $result->xpath('//doc/str[@name="url"]')[0]->__toString(); $anzeigeLink = $link; @@ -55,12 +56,18 @@ class Minisucher extends Searchengine $additionalInformation = ['date' => $dateVal]; - $subcollection = array_map('strtolower', explode(' ', $result->xpath('//doc/str[@name="subcollection"]')[0]->__toString())); - $minism = array_map('strtolower', explode(', ', simplexml_load_string($this->engine)["subcollections"])); - $result = implode(', ', array_intersect($subcollection, $minism)); - - $gefVon = "<a href=\"https://metager.de\" target=\"_blank\" rel=\"noopener\">Minisucher: $result </a>"; + $minism = simplexml_load_string($this->engine)["subcollections"]; + $subcollection = $result->xpath('//doc/str[@name="subcollection"]')[0]->__toString(); + if(!$subcollection) { + $gefVon = "<a href=\"https://metager.de\" target=\"_blank\" rel=\"noopener\">Minisucher: $minism </a>"; + } else { + $minism = array_map('strtolower', explode(', ', $minism)); + $subcollection = array_map('strtolower', explode(' ', $subcollection)); + $result = implode(', ', array_intersect($subcollection, $minism)); + $gefVon = "<a href=\"https://metager.de\" target=\"_blank\" rel=\"noopener\">Minisucher: $result </a>"; + } + $this->results[] = new \App\Models\Result( $this->engine, $title, -- GitLab