Skip to content
Snippets Groups Projects
Commit 439296a0 authored by karl's avatar karl
Browse files

Openclipart ist jetzt eingebaut und liefert ganz annehmbare Ergebnisse

parent 03346a57
No related branches found
No related tags found
2 merge requests!220Development,!211Openclipart ist jetzt eingebaut und liefert ganz annehmbare Ergebnisse
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Symfony\Component\DomCrawler\Crawler;
class Openclipart extends Searchengine
{
public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults ($result)
{
$result = preg_replace("/\r\n/si", "", $result);
try {
$content = json_decode($result);
} catch (\Exception $e) {
abort(500, "$result is not a valid json string");
}
if(!$content)
{
return;
}
$results = $content->payload;
foreach($results as $result)
{
$title = $result->title;
$link = $result->detail_link;
$anzeigeLink = $link;
$descr = $result->description;
$image = $result->svg->url;
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter,
false,
$image
);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment