Commit 3ef8f8fe authored by Dominik Hebeler's avatar Dominik Hebeler

Bildersuche eingefügt

parent 8eaafc65
......@@ -86,6 +86,23 @@ class MetaGer
$viewResults[] = get_object_vars($result);
}
if( $this->fokus === "bilder" )
{
switch ($this->out)
{
case 'results':
return '';
default:
return view('metager3bilder')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile)
->with('warnings', $this->warnings)
->with('errors', $this->errors)
->with('metager', $this);
}
}
switch ($this->out) {
case 'results':
return view('metager3results')
......
......@@ -7,7 +7,7 @@ namespace App\Models;
class Result
{
function __construct ( \SimpleXMLElement $provider, $titel, $link, $anzeigeLink , $descr, $gefVon, $sourceRank, $partnershop = false )
function __construct ( \SimpleXMLElement $provider, $titel, $link, $anzeigeLink , $descr, $gefVon, $sourceRank, $partnershop = false, $image = "" )
{
$this->titel = strip_tags(trim($titel));
$this->link = trim($link);
......@@ -41,6 +41,7 @@ class Result
$this->strippedLink = $this->getStrippedLink($this->anzeigeLink);
$this->rank = 0;
$this->partnershop = $partnershop;
$this->image = $image;
#die($this->anzeigeLink . "\r\n" . $this->strippedHost);
}
......
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Symfony\Component\DomCrawler\Crawler;
class Bing_bilder extends Searchengine
{
public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults ($result)
{
$crawler = new Crawler($result);
$crawler->filter('div#b_content div.item')->each(function (Crawler $node, $i)
{
$title = $node->filter('div.meta > a.tit')->text();
$link = $node->filter('div.meta > a.tit')->attr("href");
$anzeigeLink = $link;
$descr = $node->filter('div.meta > div.des')->text();
$image = $node->filter('a.thumb img')->attr("src");
#die($result);
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter,
false,
$image
);
} );
#die(var_dump($this->results));
}
}
\ No newline at end of file
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Symfony\Component\DomCrawler\Crawler;
class Flickr 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 = simplexml_load_string($result);
} catch (\Exception $e) {
abort(500, "$result is not a valid xml string");
}
if(!$content)
{
return;
}
$results = $content->xpath('//photos/photo');
foreach($results as $result)
{
$title = $result["title"]->__toString();
$link = "https://www.flickr.com/photos/" . $result["owner"]->__toString() . "/" . $result["id"]->__toString();
$anzeigeLink = $link;
$descr = "";
$image = "http://farm" . $result["farm"]->__toString() . ".staticflickr.com/" . $result["server"]->__toString() . "/" . $result["id"]->__toString() . "_" . $result["secret"]->__toString() . "_t.jpg";
$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
......@@ -256,15 +256,13 @@ a:hover
}
.result > .number
{
float: left;
font-size: 15px;
line-height:1;
text-align: right;
}
.result > .resultInformation
{
margin-left: 40px;
padding-left: 10px;
border-radius: 5px;
}
.result .title
......
@if(isset($ad))
<div class="result ad">
<div class="number"></div>
<div class="resultInformation">
<div class="result ad row">
<div class="number col-sm-1"></div>
<div class="resultInformation col-sm-10">
<p class="title">
<a class="title" href="{{ $ad['link'] }}" target="{{ $metager->getTab() }}" data-hoster="{{ $ad['gefVon'] }}" data-count="0">
{{ $ad['titel'] }}
......
<div class="result">
<div class="number" style="color:{{ $result->color }}">
<div class="result row">
<div class="number col-sm-1" style="color:{{ $result->color }}">
{{ $result->number }})
</div>
<div class="resultInformation">
<p class="title">
<a class="title" href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ $result->gefVon }}" data-count="{{ $result->number }}">
{{ $result->titel }}
</a>
</p>
<div class="link">
<div>
<div class="link-link">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ $result->gefVon }}" data-count="{{ $result->number }}">
{{ $result->anzeigeLink }}
</a>
</div>
<div class="options">
<a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="auto bottom" data-container="body" data-html="true" data-title="<span class='glyphicon glyphicon-cog'></span> Optionen">
@if(strlen($metager->getSite()) === 0)
<span class="glyphicon glyphicon-triangle-bottom"></span>
@endif
</a>
<div class="content hidden">
<ul class="options-list list-unstyled">
<li>
<a href="{{ $metager->generateSiteSearchLink($result->strippedHost) }}">
Suche auf dieser Domain neu starten
</a>
</li>
<li>
<a href="{{ $metager->generateRemovedHostLink($result->strippedHost) }}">
{{ $result->strippedHost }} ausblenden
</a>
</li>
@if( $result->strippedHost !== $result->strippedDomain )
<li>
<a href="{{ $metager->generateRemovedDomainLink($result->strippedDomain) }}">
*.{{ $result->strippedDomain }} ausblenden
</a>
</li>
@if( $result->image !== "" )
<div class="image col-sm-1">
<img src="{{ $result->image }}" alt="" height="50px" />
</div>
@endif
<div class="resultInformation col-sm-10">
<p class="title">
<a class="title" href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ $result->gefVon }}" data-count="{{ $result->number }}">
{{ $result->titel }}
</a>
</p>
<div class="link">
<div>
<div class="link-link">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ $result->gefVon }}" data-count="{{ $result->number }}">
{{ $result->anzeigeLink }}
</a>
</div>
<div class="options">
<a tabindex="0" data-toggle="popover" data-trigger="focus" data-placement="auto bottom" data-container="body" data-html="true" data-title="<span class='glyphicon glyphicon-cog'></span> Optionen">
@if(strlen($metager->getSite()) === 0)
<span class="glyphicon glyphicon-triangle-bottom"></span>
@endif
</ul>
</a>
<div class="content hidden">
<ul class="options-list list-unstyled">
<li>
<a href="{{ $metager->generateSiteSearchLink($result->strippedHost) }}">
Suche auf dieser Domain neu starten
</a>
</li>
<li>
<a href="{{ $metager->generateRemovedHostLink($result->strippedHost) }}">
{{ $result->strippedHost }} ausblenden
</a>
</li>
@if( $result->strippedHost !== $result->strippedDomain )
<li>
<a href="{{ $metager->generateRemovedDomainLink($result->strippedDomain) }}">
*.{{ $result->strippedDomain }} ausblenden
</a>
</li>
@endif
</ul>
</div>
</div>
</div>
<span class="hoster">
von {!! $result->gefVon !!}
</span>
@if( isset($result->partnerShop) )
<span class="partnershop-info">
<img src="/img/boosticon.png" height="13" alt="Fehler">
<a href="/boost">Partnershop</a>
</span>
@endif
<a class="proxy" onmouseover="$(this).popover('show');" onmouseout="$(this).popover('hide');" data-toggle="popover" data-placement="auto right" data-container="body" data-content="Der Link wird anonymisiert geöffnet. Ihre Daten werden nicht zum Zielserver übetragen. Möglicherweise funktionieren manche Webseiten nicht wie gewohnt." href="{{ $result->proxyLink }}" target="{{ $metager->getTab() }}">
<img src="/img/proxyicon.png" alt="Proxy-Icon" />
anonym öffnen
</a>
</div>
<span class="hoster">
von {!! $result->gefVon !!}
</span>
@if( isset($result->partnerShop) )
<span class="partnershop-info">
<img src="/img/boosticon.png" height="13" alt="Fehler">
<a href="/boost">Partnershop</a>
</span>
@endif
<a class="proxy" onmouseover="$(this).popover('show');" onmouseout="$(this).popover('hide');" data-toggle="popover" data-placement="auto right" data-container="body" data-content="Der Link wird anonymisiert geöffnet. Ihre Daten werden nicht zum Zielserver übetragen. Möglicherweise funktionieren manche Webseiten nicht wie gewohnt." href="{{ $result->proxyLink }}" target="{{ $metager->getTab() }}">
<img src="/img/proxyicon.png" alt="Proxy-Icon" />
anonym öffnen
</a>
<div class="description">{{ $result->descr }}</div>
</div>
<div class="description">{{ $result->descr }}</div>
</div>
</div>
\ No newline at end of file
@extends('layouts.resultPage')
@section('results')
<div id="container">
@foreach($metager->getResults()->items() as $result)
<div class="item">
<div class="img">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}">
<img src="{{ $result->image }}" width="150px" alt="Bild nicht gefunden"/>
</a>
</div>
</div>
@endforeach
</div>
<nav class="pager">
{!! $metager->getResults()->links() !!}
</nav>
@endsection
Markdown is supported
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