google cse pagination fix, thanks nikolay
This commit is contained in:
@@ -910,11 +910,10 @@ class google_cse{
|
||||
"image" => []
|
||||
];
|
||||
|
||||
// detect next page
|
||||
if(
|
||||
isset($json["cursor"]["isExactTotalResults"]) || // detects last page
|
||||
!isset($json["cursor"]["pages"]) // detects no results on page
|
||||
){
|
||||
// A response can contain a final page of image results while also marking
|
||||
// the cursor as exact/finished. Parse those results before deciding
|
||||
// whether another page token should be offered.
|
||||
if(!isset($json["results"]) || !is_array($json["results"])){
|
||||
|
||||
return $out;
|
||||
}
|
||||
@@ -939,6 +938,16 @@ class google_cse{
|
||||
];
|
||||
}
|
||||
|
||||
// Only decide whether a following page exists after preserving every
|
||||
// result returned on this page.
|
||||
if(
|
||||
isset($json["cursor"]["isExactTotalResults"]) || // detects last page
|
||||
!isset($json["cursor"]["pages"]) // detects no results on page
|
||||
){
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
// get next page
|
||||
$out["npt"] =
|
||||
$this->backend->store(
|
||||
|
||||
Reference in New Issue
Block a user