Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
e0b3f712
Commit
e0b3f712
authored
Aug 10, 2016
by
Phil Höfer
Browse files
Pixabay hinzugefügt
parent
c8e2b1c9
Changes
1
Show whitespace changes
Inline
Side-by-side
app/Models/parserSkripte/Pixabay.php
0 → 100644
View file @
e0b3f712
<?php
namespace
app\Models\parserSkripte
;
use
App\Models\Searchengine
;
use
Symfony\Component\DomCrawler\Crawler
;
class
Pixabay
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
=
json_decode
(
$result
);
}
catch
(
\
Exception
$e
)
{
abort
(
500
,
"
$result
is not a valid json string"
);
}
if
(
!
$content
)
{
return
;
}
$results
=
$content
->
hits
;
foreach
(
$results
as
$result
)
{
$title
=
$result
->
tags
;
$link
=
$result
->
pageURL
;
$anzeigeLink
=
$link
;
$descr
=
""
;
$image
=
$result
->
previewURL
;
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
$title
,
$link
,
$anzeigeLink
,
$descr
,
$this
->
gefVon
,
$this
->
counter
,
false
,
$image
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment