Fastbot.php 1.13 KB
Newer Older
1
2
<?php

3
4
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
5
6
7
8
9

class Fastbot extends Searchengine 
{
	public $results = [];

10
	function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
11
	{
12
		parent::__construct($engine, $metager);
13
14
		if ( strpos($this->urlEncode($metager->getEingabe()), "%") !== FALSE )
		{
15
			$this->enabled = false;
16
			return null;
17
		}
18
19
	}

20
	public function loadResults ($result)
21
	{
22
23
		$result = utf8_encode($result);
		$counter = 0;
24
25
26
27
28
29
30
31
32
		foreach( explode("\n", $result) as $line )
		{
			$line = trim($line);
			if( strlen($line) > 0 ){
				# Hier bekommen wir jedes einzelne Ergebnis
				$result = explode("|:|", $line);
				$link = $result[1];
				$link = substr($link, strpos($link, "href=\"") + 6);
				$link = substr($link, 0, strpos($link, "\""));
33
34
				$counter++; 
				$this->gefVon = "<a href=\"" . $this->homepage . "\" target=\"_blank\">" . $this->displayName . " " . trans('results.redirect') . "</a>";
35
				$this->results[] = new \App\Models\Result(
36
					$this->engine,
37
38
39
					trim(strip_tags($result[1])),
					$link,
					$result[3],
40
					$result[2],
41
42
					$this->gefVon,
					$counter
43
44
45
46
					);
			}
			
		}
47

48
49
	}
}