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
87748468
Commit
87748468
authored
Oct 07, 2016
by
Karl
Browse files
Pagination für die Bildersuchmaschinen eingefügt
parent
c81604e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/Models/parserSkripte/Europeana.php
View file @
87748468
...
...
@@ -30,24 +30,14 @@ class Europeana extends Searchengine
foreach
(
$results
as
$result
)
{
if
(
isset
(
$result
->
edmPreview
))
{
$title
=
$result
->
title
[
0
];
if
(
preg_match
(
"/(.+)\?.*/si"
,
$result
->
guid
,
$match
))
{
$link
=
$match
[
1
];
}
else
{
$link
=
""
;
}
$anzeigeLink
=
$link
;
$descr
=
""
;
/*if (preg_match("/(?:uri=)(.+)/si", urldecode($result->edmPreview[0]), $match)){
$image = $match[1];
} else {
$image = "";
}
echo $image . "
";*/
$image
=
urldecode
(
$result
->
edmPreview
[
0
]);
$image
=
urldecode
(
$result
->
edmPreview
[
0
]);
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
$this
->
engine
,
...
...
@@ -63,4 +53,17 @@ class Europeana extends Searchengine
}
}
}
public
function
getNext
(
\
App\MetaGer
$metager
,
$result
)
{
$start
=
(
$metager
->
getPage
())
*
10
+
1
;
$content
=
json_decode
(
$result
);
if
(
$start
>
$content
->
totalResults
)
{
return
;
}
$next
=
new
Europeana
(
simplexml_load_string
(
$this
->
engine
),
$metager
);
$next
->
getString
.
=
"&start="
.
$start
;
$next
->
hash
=
md5
(
$next
->
host
.
$next
->
getString
.
$next
->
port
.
$next
->
name
);
$this
->
next
=
$next
;
}
}
app/Models/parserSkripte/Flickr.php
View file @
87748468
...
...
@@ -46,4 +46,27 @@ class Flickr extends Searchengine
);
}
}
public
function
getNext
(
\
App\MetaGer
$metager
,
$result
)
{
$page
=
$metager
->
getPage
()
+
1
;
$result
=
preg_replace
(
"/
\r\n
/si"
,
""
,
$result
);
$content
=
simplexml_load_string
(
$result
);
$results
=
$content
->
xpath
(
'//photos'
)[
0
];
try
{
$content
=
simplexml_load_string
(
$result
);
}
catch
(
\
Exception
$e
)
{
abort
(
500
,
"
$result
is not a valid xml string"
);
}
if
(
!
$content
)
{
return
;
}
if
(
$page
>=
intval
(
$results
[
"pages"
]
->
__toString
()))
{
return
;
}
$next
=
new
Flickr
(
simplexml_load_string
(
$this
->
engine
),
$metager
);
$next
->
getString
.
=
"&page="
.
$page
;
$next
->
hash
=
md5
(
$next
->
host
.
$next
->
getString
.
$next
->
port
.
$next
->
name
);
$this
->
next
=
$next
;
}
}
app/Models/parserSkripte/Openclipart.php
View file @
87748468
...
...
@@ -47,4 +47,16 @@ class Openclipart extends Searchengine
);
}
}
public
function
getNext
(
\
App\MetaGer
$metager
,
$result
)
{
$content
=
json_decode
(
$result
);
if
(
$content
->
info
->
current_page
>
$content
->
info
->
pages
)
{
return
;
}
$next
=
new
Openclipart
(
simplexml_load_string
(
$this
->
engine
),
$metager
);
$next
->
getString
.
=
"&page="
.
(
$metager
->
getPage
()
+
1
);
$next
->
hash
=
md5
(
$next
->
host
.
$next
->
getString
.
$next
->
port
.
$next
->
name
);
$this
->
next
=
$next
;
}
}
app/Models/parserSkripte/Pixabay.php
View file @
87748468
...
...
@@ -47,4 +47,17 @@ class Pixabay extends Searchengine
);
}
}
public
function
getNext
(
\
App\MetaGer
$metager
,
$result
)
{
$page
=
$metager
->
getPage
()
+
1
;
$content
=
json_decode
(
$result
);
if
(
$page
*
20
>
$content
->
total
)
{
return
;
}
$next
=
new
Pixabay
(
simplexml_load_string
(
$this
->
engine
),
$metager
);
$next
->
getString
.
=
"&page="
.
$page
;
$next
->
hash
=
md5
(
$next
->
host
.
$next
->
getString
.
$next
->
port
.
$next
->
name
);
$this
->
next
=
$next
;
}
}
Write
Preview
Markdown
is supported
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