Commit 4029df8f authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Die Blade Dateien der Ergebnisausgabe haben jetzt eine kürzere benennung

Einige Dinge wurden Zusammengefasst und Redundanzen entfernt
parent 33743bf9
...@@ -88,7 +88,7 @@ class MetaGer ...@@ -88,7 +88,7 @@ class MetaGer
} }
# Erstellt aus den gesammelten Ergebnissen den View # Erstellt aus den gesammelten Ergebnissen den View
public function createView($quicktipResults = NULL) public function createView($quicktipResults = null)
{ {
# Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können # Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können
$focusPages = []; $focusPages = [];
...@@ -109,7 +109,7 @@ class MetaGer ...@@ -109,7 +109,7 @@ class MetaGer
if ($this->fokus === "bilder") { if ($this->fokus === "bilder") {
switch ($this->out) { switch ($this->out) {
case 'results': case 'results':
return view('metager3bilderresults') return view('resultpages.results_images')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -119,7 +119,7 @@ class MetaGer ...@@ -119,7 +119,7 @@ class MetaGer
->with('metager', $this) ->with('metager', $this)
->with('browser', (new Agent())->browser()); ->with('browser', (new Agent())->browser());
default: default:
return view('metager3bilder') return view('resultpages.resultpage_images')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -132,7 +132,7 @@ class MetaGer ...@@ -132,7 +132,7 @@ class MetaGer
} else { } else {
switch ($this->out) { switch ($this->out) {
case 'results': case 'results':
return view('metager3results') return view('resultpages.results')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -144,7 +144,7 @@ class MetaGer ...@@ -144,7 +144,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'results-with-style': case 'results-with-style':
return view('metager3') return view('resultpages.resultpage')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -157,7 +157,7 @@ class MetaGer ...@@ -157,7 +157,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'rich': case 'rich':
return view('metager3rich') return view('resultpages.metager3rich')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -169,7 +169,7 @@ class MetaGer ...@@ -169,7 +169,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'rss20': case 'rss20':
return view('metager3resultsrss20') return view('resultpages.metager3resultsrss20')
->with('results', $viewResults) ->with('results', $viewResults)
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('apiAuthorized', $this->apiAuthorized) ->with('apiAuthorized', $this->apiAuthorized)
...@@ -178,7 +178,7 @@ class MetaGer ...@@ -178,7 +178,7 @@ class MetaGer
->with('fokus', $this->fokus); ->with('fokus', $this->fokus);
break; break;
case 'atom10': case 'atom10':
return response()->view('metager3resultsatom10', ['results' => $viewResults,'eingabe' => $this->eingabe,'metager' => $this,'resultcount' => sizeof($viewResults)]) return response()->view('resultpages.metager3resultsatom10', ['results' => $viewResults, 'eingabe' => $this->eingabe, 'metager' => $this, 'resultcount' => sizeof($viewResults)])
->header('Content-Type', 'application/xml'); ->header('Content-Type', 'application/xml');
break; break;
case 'result-count': case 'result-count':
...@@ -186,7 +186,7 @@ class MetaGer ...@@ -186,7 +186,7 @@ class MetaGer
return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2); return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2);
break; break;
default: default:
return view('metager3') return view('resultpages.resultpage')
->with('eingabe', $this->eingabe) ->with('eingabe', $this->eingabe)
->with('focusPages', $focusPages) ->with('focusPages', $focusPages)
->with('mobile', $this->mobile) ->with('mobile', $this->mobile)
...@@ -475,7 +475,8 @@ class MetaGer ...@@ -475,7 +475,8 @@ class MetaGer
} }
} }
public function createQuicktips() { public function createQuicktips()
{
# Die quicktips werden als job erstellt und zur Abarbeitung freigegeben # Die quicktips werden als job erstellt und zur Abarbeitung freigegeben
$quicktips = new \App\Models\Quicktips\Quicktips($this->q, $this->lang, $this->getTime(), $this->getHashCode()); $quicktips = new \App\Models\Quicktips\Quicktips($this->q, $this->lang, $this->getTime(), $this->getHashCode());
return $quicktips; return $quicktips;
...@@ -501,7 +502,7 @@ class MetaGer ...@@ -501,7 +502,7 @@ class MetaGer
$isCustomSearch = $this->startsWith($this->fokus, 'focus_'); $isCustomSearch = $this->startsWith($this->fokus, 'focus_');
# Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt # Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt
if($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) { if ($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) {
$isCustomSearch = false; $isCustomSearch = false;
$this->fokus = 'web'; $this->fokus = 'web';
} }
...@@ -1088,18 +1089,18 @@ class MetaGer ...@@ -1088,18 +1089,18 @@ class MetaGer
$this->q = $match[1] . $match[3]; $this->q = $match[1] . $match[3];
} }
# Overwrite Setting if it's submitted via Parameter # Overwrite Setting if it's submitted via Parameter
if($request->has('blacklist')){ if ($request->has('blacklist')) {
$this->hostBlacklist = []; $this->hostBlacklist = [];
$blacklistString = trim($request->input('blacklist')); $blacklistString = trim($request->input('blacklist'));
if(strpos($blacklistString, ",") !== FALSE){ if (strpos($blacklistString, ",") !== false) {
$blacklistArray = explode(',', $blacklistString); $blacklistArray = explode(',', $blacklistString);
foreach($blacklistArray as $blacklistElement){ foreach ($blacklistArray as $blacklistElement) {
$blacklistElement = trim($blacklistElement); $blacklistElement = trim($blacklistElement);
if(strpos($blacklistElement, "*") !== 0){ if (strpos($blacklistElement, "*") !== 0) {
$this->hostBlacklist[] = $blacklistElement; $this->hostBlacklist[] = $blacklistElement;
} }
} }
}else if(strpos($blacklistString, "*") !== 0){ } else if (strpos($blacklistString, "*") !== 0) {
$this->hostBlacklist[] = $blacklistString; $this->hostBlacklist[] = $blacklistString;
} }
} }
...@@ -1123,19 +1124,19 @@ class MetaGer ...@@ -1123,19 +1124,19 @@ class MetaGer
$this->q = $match[1] . $match[3]; $this->q = $match[1] . $match[3];
} }
# Overwrite Setting if it's submitted via Parameter # Overwrite Setting if it's submitted via Parameter
if($request->has('blacklist')){ if ($request->has('blacklist')) {
$this->domainBlacklist = []; $this->domainBlacklist = [];
$blacklistString = trim($request->input('blacklist')); $blacklistString = trim($request->input('blacklist'));
if(strpos($blacklistString, ",") !== FALSE){ if (strpos($blacklistString, ",") !== false) {
$blacklistArray = explode(',', $blacklistString); $blacklistArray = explode(',', $blacklistString);
foreach($blacklistArray as $blacklistElement){ foreach ($blacklistArray as $blacklistElement) {
$blacklistElement = trim($blacklistElement); $blacklistElement = trim($blacklistElement);
if(strpos($blacklistElement, "*.") === 0){ if (strpos($blacklistElement, "*.") === 0) {
$this->domainBlacklist[] = substr($blacklistElement, strpos($blacklistElement, "*.")+2); $this->domainBlacklist[] = substr($blacklistElement, strpos($blacklistElement, "*.") + 2);
} }
} }
}else if(strpos($blacklistString, "*.") === 0){ } else if (strpos($blacklistString, "*.") === 0) {
$this->domainBlacklist[] = substr($blacklistString, strpos($blacklistString, "*.")+2); $this->domainBlacklist[] = substr($blacklistString, strpos($blacklistString, "*.") + 2);
} }
} }
// print the domain blacklist as a user warning // print the domain blacklist as a user warning
...@@ -1175,16 +1176,16 @@ class MetaGer ...@@ -1175,16 +1176,16 @@ class MetaGer
$this->q = $match[1] . $match[3]; $this->q = $match[1] . $match[3];
} }
# Overwrite Setting if submitted via Parameter # Overwrite Setting if submitted via Parameter
if($request->has('stop')){ if ($request->has('stop')) {
$this->stopWords = []; $this->stopWords = [];
$stop = trim($request->input('stop')); $stop = trim($request->input('stop'));
if(strpos($stop, ',') !== FALSE){ if (strpos($stop, ',') !== false) {
$stopArray = explode(',', $stop); $stopArray = explode(',', $stop);
foreach($stopArray as $stopElement){ foreach ($stopArray as $stopElement) {
$stopElement = trim($stopElement); $stopElement = trim($stopElement);
$this->stopWords[] = $stopElement; $this->stopWords[] = $stopElement;
} }
}else{ } else {
$this->stopWords[] = $stop; $this->stopWords[] = $stop;
} }
} }
...@@ -1264,7 +1265,8 @@ class MetaGer ...@@ -1264,7 +1265,8 @@ class MetaGer
} }
} }
public function atLeastOneSearchengineSelected(Request $request) { public function atLeastOneSearchengineSelected(Request $request)
{
foreach ($request->all() as $key => $value) { foreach ($request->all() as $key => $value) {
if ($this->startsWith($key, 'engine')) { if ($this->startsWith($key, 'engine')) {
return true; return true;
......
@extends('layouts.resultPage')
@section('results')
{{-- Show all errors --}}
@if(sizeof($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
{{-- Show all warnings --}}
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
<main id="results">
{{-- Show initial ads --}}
@if($mobile)
@include('layouts.ad', ['ad' => $metager->popAd()])
@else
@for($i = 0; $i <= 2; $i++)
@include('layouts.ad', ['ad' => $metager->popAd()])
@endfor
@endif
{{-- Show map --}}
{{-- Create results and ongoing ads --}}
@foreach($metager->getResults() as $result)
@if($mobile)
@if($result->number % 4 === 0)
@include('layouts.ad', ['ad' => $metager->popAd()])
@endif
@else
@if($result->number % 7 === 0)
@include('layouts.ad', ['ad' => $metager->popAd()])
@endif
@endif
@include('layouts.result', ['result' => $result])
@endforeach
{{-- Show pagination --}}
<nav class="mg-pager" aria-label="...">
<div @if($metager->getPage() === 1) class="disabled" @endif>
<a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a>
</div>
<div @if($metager->nextSearchLink() === "#") class="disabled" @endif>
<a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a>
</div>
</nav>
</main>
@endsection
@extends('layouts.resultPage')
@section('results')
@if(sizeof($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
<div id="container" class="image-container">
@foreach($metager->getResults() as $result)
<div class="item image-item">
<div class="img">
<a href="{{ $result->link }}" target="{{ $metager->getNewtab() }}"><img src="{{ $metager->getImageProxyLink($result->image) }}" width="150px" alt="" rel="noopener"/></a>
<span class="label label-default hostlabel">{!! $result->gefVon !!}</span>
</div>
</div>
@endforeach
</div>
<nav aria-label="...">
<ul class="pager">
<li @if($metager->getPage() === 1) class="disabled" @endif><a href="@if($metager->getPage() === 1) # @else javascript:history.back() @endif">{{ trans('results.zurueck') }}</a></li>
<li @if($metager->nextSearchLink() === "#") class="disabled" @endif><a href="{{ $metager->nextSearchLink() }}">{{ trans('results.weiter') }}</a></li>
</ul>
</nav>
@endsection
<?xmlversion = "1.0"encoding = "UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg="http://metager.de/opensearch/"
xmlns:ad="http://a9.com/-/opensearch/extensions/advertisement/1.0/">
<title>{!! htmlspecialchars($eingabe, ENT_XML1, 'UTF-8'); !!} - MetaGer</title>
<link href="{{ url()->full() }}"/>
<updated>{{ date('c') }}</updated>
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
<link rel="next" href="{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}" type="application/atom+xml"/>
<id>urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@foreach($metager->getResults() as $result)
@if($result->number % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@endif
<entry>
<title>{!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!}</title>
<link href="{!! htmlspecialchars($result->link, ENT_XML1, 'UTF-8'); !!}" />
<mg:anzeigeLink>{!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!}</mg:anzeigeLink>
<content type="text">
{!! htmlspecialchars($result->descr, ENT_XML1, 'UTF-8'); !!}
</content>
</entry>
@endforeach
</feed>
\ No newline at end of file
{{-- Show all errors --}}
@if(sizeof($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
\ No newline at end of file
{{-- Show pagination --}}
<nav class="mg-pager" aria-label="...">
<div @if($metager->getPage() === 1) class="disabled" @endif>
<a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a>
</div>
<div @if($metager->nextSearchLink() === "#") class="disabled" @endif>
<a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a>
</div>
</nav>
\ No newline at end of file
{{-- Show all warnings --}}
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
\ No newline at end of file
<?xmlversion = "1.0"encoding = "UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg="http://metager.de/opensearch/"
xmlns:ad="http://a9.com/-/opensearch/extensions/advertisement/1.0/">
<title>{!! htmlspecialchars($eingabe, ENT_XML1, 'UTF-8'); !!} - MetaGer</title>
<link href="{{ url()->full() }}"/>
<updated>{{ date('c') }}</updated>
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
<link rel="next" href="{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}" type="application/atom+xml"/>
<id>urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@foreach($metager->getResults() as $result)
@if($result->number % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@endif
<entry>
<title>{!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!}</title>
<link href="{!! htmlspecialchars($result->link, ENT_XML1, 'UTF-8'); !!}" />
<mg:anzeigeLink>{!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!}</mg:anzeigeLink>
<content type="text">
{!! htmlspecialchars($result->descr, ENT_XML1, 'UTF-8'); !!}
</content>
</entry>
@endforeach
</feed>
\ No newline at end of file
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults> <opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/> <opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
<mg:nextSearchResults url="{{htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES)}}" /> <mg:nextSearchResults url="{{htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES)}}" />
@if($apiAuthorized) @if($apiAuthorized)
@foreach($metager->getResults() as $result) @foreach($metager->getResults() as $result)
<item> <item>
......
@extends('layouts.resultPage')
@section('results')
@include('resultpages.results')
@endsection
@extends('layouts.resultPage')
@section('results')
@include('resultpages.results_images')
@endsection
{{-- Show all errors --}} @include('parts.errors')
@if(sizeof($errors) > 0) @include('parts.warnings')
<div class="alert alert-danger">
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
{{-- Show all warnings --}}
@if(sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
<div id="results"> <div id="results">
@if($mobile) @if($mobile)
@include('layouts.ad', ['ad' => $metager->popAd()]) @include('layouts.ad', ['ad' => $metager->popAd()])
...@@ -26,7 +8,6 @@ ...@@ -26,7 +8,6 @@
@include('layouts.ad', ['ad' => $metager->popAd()]) @include('layouts.ad', ['ad' => $metager->popAd()])
@endfor @endfor
@endif @endif
{{-- Show map --}}
{{-- Create results and ongoing ads --}} {{-- Create results and ongoing ads --}}
@foreach($metager->getResults() as $result) @foreach($metager->getResults() as $result)
@if($mobile) @if($mobile)
...@@ -40,15 +21,7 @@ ...@@ -40,15 +21,7 @@
@endif @endif
@include('layouts.result', ['result' => $result]) @include('layouts.result', ['result' => $result])
@endforeach @endforeach
{{-- Show pagination --}} @include('parts.pager')
<nav class="mg-pager" aria-label="...">
<div @if($metager->getPage() === 1) class="disabled" @endif>
<a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a>
</div>
<div @if($metager->nextSearchLink() === "#") class="disabled" @endif>
<a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a>
</div>
</nav>
</div> </div>
@if( $metager->showQuicktips() ) @if( $metager->showQuicktips() )
<div id="quicktips"></div> <div id="quicktips"></div>
......
@if( sizeof($errors) > 0 ) @include('parts.errors')
<div class="alert alert-danger"> @include('parts.warnings')
<ul>
@foreach($errors as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
@if( sizeof($warnings) > 0)
<div class="alert alert-warning">
<ul>
@foreach($warnings as $warning)
<li>{!! $warning !!}</li>
@endforeach
</ul>
</div>
@endif
<div id="container" class="image-container"> <div id="container" class="image-container">
@foreach($metager->getResults() as $result) @foreach($metager->getResults() as $result)
<div class="item image-item"> <div class="item image-item">
...@@ -26,9 +10,4 @@ ...@@ -26,9 +10,4 @@
</div> </div>
@endforeach @endforeach
</div> </div>
<nav aria-label="..."> @include('parts.pager')
<ul class="pager">
<li @if($metager->getPage() === 1) class="disabled" @endif><a href="@if($metager->getPage() === 1) # @else javascript:history.back() @endif">{{ trans('results.zurueck') }}</a></li>
<li @if($metager->nextSearchLink() === "#") class="disabled" @endif><a href="{{ $metager->nextSearchLink() }}">{{ trans('results.weiter') }}</a></li>
</ul>
</nav>
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