Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
7ac1013d
Commit
7ac1013d
authored
6 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
Added a route for the xml api
parent
e0282834
No related branches found
No related tags found
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/MetaGer.php
+16
-12
16 additions, 12 deletions
app/MetaGer.php
resources/views/resultpages/metager3resultsatom10.blade.php
+4
-2
4 additions, 2 deletions
resources/views/resultpages/metager3resultsatom10.blade.php
with
20 additions
and
14 deletions
app/MetaGer.php
+
16
−
12
View file @
7ac1013d
...
@@ -181,8 +181,11 @@ class MetaGer
...
@@ -181,8 +181,11 @@ class MetaGer
->
with
(
'resultcount'
,
sizeof
(
$viewResults
))
->
with
(
'resultcount'
,
sizeof
(
$viewResults
))
->
with
(
'fokus'
,
$this
->
fokus
);
->
with
(
'fokus'
,
$this
->
fokus
);
break
;
break
;
case
'api'
:
return
response
()
->
view
(
'resultpages.metager3resultsatom10'
,
[
'results'
=>
$viewResults
,
'eingabe'
=>
$this
->
eingabe
,
'metager'
=>
$this
,
'resultcount'
=>
sizeof
(
$viewResults
),
'apiAuthorized'
=>
$this
->
apiAuthorized
])
->
header
(
'Content-Type'
,
'application/xml'
);
break
;
case
'atom10'
:
case
'atom10'
:
return
response
()
->
view
(
'resultpages.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
)
,
'apiAuthorized'
=>
true
])
->
header
(
'Content-Type'
,
'application/xml'
);
->
header
(
'Content-Type'
,
'application/xml'
);
break
;
break
;
case
'result-count'
:
case
'result-count'
:
...
@@ -532,8 +535,8 @@ class MetaGer
...
@@ -532,8 +535,8 @@ class MetaGer
$sumaCount
=
0
;
$sumaCount
=
0
;
/*
/*
* Erstellt eine Liste mit Foki, die verfügbar sind
* Erstellt eine Liste mit Foki, die verfügbar sind
*/
*/
$this
->
availableFoki
=
[];
$this
->
availableFoki
=
[];
foreach
(
$sumas
as
$suma
)
{
foreach
(
$sumas
as
$suma
)
{
$foki
=
explode
(
","
,
trim
(
$suma
[
"type"
]));
$foki
=
explode
(
","
,
trim
(
$suma
[
"type"
]));
...
@@ -954,7 +957,7 @@ class MetaGer
...
@@ -954,7 +957,7 @@ class MetaGer
public
function
parseFormData
(
Request
$request
)
public
function
parseFormData
(
Request
$request
)
{
{
# Sichert, dass der request in UTF-8 formatiert ist
# Sichert, dass der request in UTF-8 formatiert ist
if
(
$request
->
input
(
'encoding'
,
'utf8'
)
!==
"utf8"
)
{
if
(
$request
->
input
(
'encoding'
,
'utf8'
)
!==
"utf8"
)
{
# In früheren Versionen, als es den Encoding Parameter noch nicht gab, wurden die Daten in ISO-8859-1 übertragen
# In früheren Versionen, als es den Encoding Parameter noch nicht gab, wurden die Daten in ISO-8859-1 übertragen
...
@@ -1091,7 +1094,7 @@ class MetaGer
...
@@ -1091,7 +1094,7 @@ class MetaGer
$this
->
out
=
$request
->
input
(
'out'
,
"html"
);
$this
->
out
=
$request
->
input
(
'out'
,
"html"
);
# Standard output format html
# Standard output format html
if
(
$this
->
out
!==
"html"
&&
$this
->
out
!==
"json"
&&
$this
->
out
!==
"results"
&&
$this
->
out
!==
"results-with-style"
&&
$this
->
out
!==
"result-count"
&&
$this
->
out
!==
"rss20"
&&
$this
->
out
!==
"atom10"
&&
$this
->
out
!==
"rich"
)
{
if
(
$this
->
out
!==
"html"
&&
$this
->
out
!==
"json"
&&
$this
->
out
!==
"results"
&&
$this
->
out
!==
"results-with-style"
&&
$this
->
out
!==
"result-count"
&&
$this
->
out
!==
"rss20"
&&
$this
->
out
!==
"atom10"
&&
$this
->
out
!==
"rich"
&&
$this
->
out
!==
"api"
)
{
$this
->
out
=
"html"
;
$this
->
out
=
"html"
;
}
}
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
...
@@ -1241,12 +1244,12 @@ class MetaGer
...
@@ -1241,12 +1244,12 @@ class MetaGer
{
{
$oldQ
=
$this
->
q
;
$oldQ
=
$this
->
q
;
// matches '[... ]-test[ ...]'
// matches '[... ]-test[ ...]'
$words
=
preg_split
(
"/\s+/si"
,
$this
->
q
);
$words
=
preg_split
(
"/\s+/si"
,
$this
->
q
);
$newQ
=
""
;
$newQ
=
""
;
foreach
(
$words
as
$word
){
foreach
(
$words
as
$word
)
{
if
(
strpos
(
$word
,
"-"
)
===
0
&&
strlen
(
$word
)
>
1
){
if
(
strpos
(
$word
,
"-"
)
===
0
&&
strlen
(
$word
)
>
1
)
{
$this
->
stopWords
[]
=
substr
(
$word
,
1
);
$this
->
stopWords
[]
=
substr
(
$word
,
1
);
}
else
{
}
else
{
$newQ
.
=
" "
.
$word
;
$newQ
.
=
" "
.
$word
;
}
}
}
}
...
@@ -1513,11 +1516,13 @@ class MetaGer
...
@@ -1513,11 +1516,13 @@ class MetaGer
# Einfache Getter
# Einfache Getter
public
function
getVerificationId
()
{
public
function
getVerificationId
()
{
return
$this
->
verificationId
;
return
$this
->
verificationId
;
}
}
public
function
getVerificationCount
()
{
public
function
getVerificationCount
()
{
return
$this
->
verificationCount
;
return
$this
->
verificationCount
;
}
}
...
@@ -1585,7 +1590,6 @@ class MetaGer
...
@@ -1585,7 +1590,6 @@ class MetaGer
return
$this
->
availableFoki
;
return
$this
->
availableFoki
;
}
}
public
function
getSprueche
()
public
function
getSprueche
()
{
{
return
$this
->
sprueche
;
return
$this
->
sprueche
;
...
...
This diff is collapsed.
Click to expand it.
resources/views/resultpages/metager3resultsatom10.blade.php
+
4
−
2
View file @
7ac1013d
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<feed
xmlns=
"http://www.w3.org/2005/Atom"
<feed
xmlns=
"http://www.w3.org/2005/Atom"
xmlns:opensearch=
"http://a9.com/-/spec/opensearch/1.1/"
xmlns:opensearch=
"http://a9.com/-/spec/opensearch/1.1/"
xmlns:mg=
"http://metager.de/opensearch/"
xmlns:mg=
"http://metager.de/opensearch/"
xmlns:ad=
"http://a9.com/-/opensearch/extensions/advertisement/1.0/"
>
xmlns:ad=
"http://a9.com/-/opensearch/extensions/advertisement/1.0/"
>
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<link
rel=
"next"
href=
"{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}"
type=
"application/atom+xml"
/>
<link
rel=
"next"
href=
"{{ htmlspecialchars($metager->nextSearchLink() ,ENT_QUOTES) }}"
type=
"application/atom+xml"
/>
<id>
urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240
</id>
<id>
urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240
</id>
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@if($apiAuthorized)
@foreach($metager->getResults() as $result)
@foreach($metager->getResults() as $result)
@if($result->number % 5 === 0)
@if($result->number % 5 === 0)
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
@include('layouts.atom10ad', ['ad' => $metager->popAd()])
...
@@ -24,4 +25,5 @@
...
@@ -24,4 +25,5 @@
</content>
</content>
</entry>
</entry>
@endforeach
@endforeach
</feed>
@endif
\ No newline at end of file
</feed>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment