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
e2111be1
Commit
e2111be1
authored
7 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Plain Diff
Merge branch 'development' into 'master'
Development See merge request
!1036
parents
1c7e852e
14d1e633
No related branches found
No related tags found
3 merge requests
!1061
Development
,
!1046
Patch
,
!1036
Development
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/MetaGer.php
+36
-3
36 additions, 3 deletions
app/MetaGer.php
resources/views/metager3resultsatom10.blade.php
+24
-0
24 additions, 0 deletions
resources/views/metager3resultsatom10.blade.php
with
60 additions
and
3 deletions
app/MetaGer.php
+
36
−
3
View file @
e2111be1
...
...
@@ -95,10 +95,8 @@ class MetaGer
foreach
(
$this
->
results
as
$result
)
{
$viewResults
[]
=
get_object_vars
(
$result
);
}
# Wir müssen natürlich noch den Log für die durchgeführte Suche schreiben:
$this
->
createLogs
();
if
(
$this
->
fokus
===
"bilder"
)
{
switch
(
$this
->
out
)
{
case
'results'
:
...
...
@@ -166,6 +164,10 @@ class MetaGer
->
with
(
'metager'
,
$this
)
->
with
(
'resultcount'
,
sizeof
(
$viewResults
));
break
;
case
'atom10'
:
return
response
()
->
view
(
'metager3resultsatom10'
,
[
'results'
=>
$viewResults
,
'eingabe'
=>
$this
->
eingabe
,
'metager'
=>
$this
,
'resultcount'
=>
sizeof
(
$viewResults
)])
->
header
(
'Content-Type'
,
'application/xml'
);
break
;
case
'result-count'
:
# Wir geben die Ergebniszahl und die benötigte Zeit zurück:
return
sizeof
(
$viewResults
)
.
";"
.
round
((
microtime
(
true
)
-
$this
->
starttime
),
2
);
...
...
@@ -235,6 +237,9 @@ class MetaGer
#Adgoal Implementation
$this
->
results
=
$this
->
parseAdgoal
(
$this
->
results
);
#Amazon Affiliate (MetaGers tag ist: metager04-21)
$this
->
results
=
$this
->
parseAmazon
(
$this
->
results
);
$counter
=
0
;
$firstRank
=
0
;
...
...
@@ -433,6 +438,34 @@ class MetaGer
return
$results
;
}
public
function
parseAmazon
(
$results
)
{
$amazonTag
=
"metager04-21"
;
foreach
(
$results
as
$result
)
{
$link
=
$result
->
anzeigeLink
;
if
(
strpos
(
$link
,
"http"
)
!==
0
)
{
$link
=
"http://"
.
$link
;
}
$info
=
parse_url
(
$link
);
if
(
isset
(
$info
[
"host"
])){
$host
=
$info
[
'host'
];
$newurl
=
$link
;
if
(
strpos
(
$host
,
"amazon"
)
!==
FALSE
){
# This is Probably an Amazon Link. We'll add our tag as get parameter
if
(
isset
(
$info
[
"query"
])){
$newurl
.
=
"&tag=metager04-21"
;
}
else
{
$newurl
.
=
"?tag=metager04-21"
;
}
}
$result
->
link
=
$newurl
;
$result
->
partnershop
=
true
;
}
}
return
$results
;
}
public
function
authorize
(
$key
)
{
...
...
@@ -1013,7 +1046,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"
&&
$this
->
out
!==
"rss20"
&&
$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
=
"html"
;
}
# Wir schalten den Cache aus, wenn die Ergebniszahl überprüft werden soll
...
...
This diff is collapsed.
Click to expand it.
resources/views/metager3resultsatom10.blade.php
0 → 100644
+
24
−
0
View file @
e2111be1
<?
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/"
>
<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>
@foreach($metager->getResults() as $result)
<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->longDescr, ENT_XML1, 'UTF-8'); !!}
</content>
</entry>
@endforeach
</feed>
<!-- Muster zu finden unter http://www.opensearch.org/Specifications/OpenSearch/1.1#Example_of_OpenSearch_response_elements_in_RSS_2.0 -->
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