Skip to content
Snippets Groups Projects
Commit 4b761d4b authored by Phil Höfer's avatar Phil Höfer
Browse files

Integration von OpenSearch/RSS 2.0

parent facf3b71
No related branches found
No related tags found
2 merge requests!773Development,!769Resolve "Such-API"
......@@ -140,6 +140,13 @@ class MetaGer
->with('suspendheader', "yes")
->with('browser', (new Agent())->browser());
break;
case 'rss20':
return view('metager3resultsrss20')
->with('results', $viewResults)
->with('eingabe', $this->eingabe)
->with('metager', $this)
->with('resultcount', sizeof($viewResults));
break;
case 'result-count':
# Wir geben die Ergebniszahl und die benötigte Zeit zurück:
return sizeof($viewResults) . ";" . round((microtime(true) - $this->starttime), 2);
......@@ -974,7 +981,7 @@ class MetaGer
}
$this->out = $request->input('out', "html");
# Standard output format html
if ($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style" && $this->out !== "result-count") {
if ($this->out !== "html" && $this->out !== "json" && $this->out !== "results" && $this->out !== "results-with-style" && $this->out !== "result-count" && $this->out !== "rss20") {
$this->out = "html";
}
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
......
<?xmlversion = "1.0"encoding = "UTF-8"?>
<rss version="2.0"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ $eingabe }} - MetaGer</title>
<description></description>
<opensearch:totalResults>{{ $resultcount }}</opensearch:totalResults>
<opensearch:Query role="request" searchTerms="{{ htmlspecialchars($eingabe, ENT_QUOTES) }}"/>
@foreach($metager->getResults() as $result)
<item>
<title>{{ $result->titel }}</title>
<link>{{ $result->link }}</link>
<description>
{{ $result->descr }}
</description>
</item>
@endforeach
</channel>
</rss>
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