Commit 83c56c52 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Bugfix bei dem Manchmal die falschen Pagination Links generiert wurden

Qip eingefügt
parent a09540d4
...@@ -2,33 +2,37 @@ ...@@ -2,33 +2,37 @@
namespace app\Models\parserSkripte; namespace app\Models\parserSkripte;
use App\Models\Searchengine; use App\Models\Searchengine;
use Log;
class Qip extends Searchengine class Qip extends Searchengine
{ {
public $results = []; public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager) function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{ {
parent::__construct($engine, $metager); parent::__construct($engine, $metager);
} }
public function loadResults ($result) public function loadResults ($result)
{ {
die($result); $result = preg_replace("/\r\n/si", "", $result);
$results = trim($result); try {
$content = simplexml_load_string($result);
} catch (\Exception $e) {
abort(500, "$result is not a valid xml string");
}
foreach( explode("\n", $results) as $result ) if(!$content)
{
return;
}
$results = $content->xpath('//channel/item');
foreach($results as $result)
{ {
$res = explode("|", $result); $title = $result->{"title"}->__toString();
if(sizeof($res) < 3) $link = $result->{"link"}->__toString();
{
continue;
}
$title = $res[0];
$link = $res[2];
$anzeigeLink = $link; $anzeigeLink = $link;
$descr = $res[1]; $descr = $result->{"description"}->__toString();
$this->counter++; $this->counter++;
$this->results[] = new \App\Models\Result( $this->results[] = new \App\Models\Result(
$this->engine, $this->engine,
...@@ -38,9 +42,7 @@ class Qip extends Searchengine ...@@ -38,9 +42,7 @@ class Qip extends Searchengine
$descr, $descr,
$this->gefVon, $this->gefVon,
$this->counter $this->counter
); );
} }
} }
} }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment