Include image count and offset in root tag
This commit is contained in:
parent
b6235695da
commit
619382d1b9
@ -265,7 +265,7 @@ class DanbooruApi extends Extension {
|
|||||||
* id: id to search for (comma delimited)
|
* id: id to search for (comma delimited)
|
||||||
* tags: what tags to search for
|
* tags: what tags to search for
|
||||||
* limit: limit
|
* limit: limit
|
||||||
* offset: offset
|
* page: page number
|
||||||
* after_id: limit results to posts added after this id
|
* after_id: limit results to posts added after this id
|
||||||
*/
|
*/
|
||||||
if(($event->get_arg(1) == 'find_posts') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'index.xml')))
|
if(($event->get_arg(1) == 'find_posts') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'index.xml')))
|
||||||
@ -290,12 +290,13 @@ class DanbooruApi extends Extension {
|
|||||||
$limit = isset($_GET['limit']) ? int_escape($_GET['limit']) : 100;
|
$limit = isset($_GET['limit']) ? int_escape($_GET['limit']) : 100;
|
||||||
$start = (isset($_GET['page']) ? int_escape($_GET['page'])-1 : 0) * $limit;
|
$start = (isset($_GET['page']) ? int_escape($_GET['page'])-1 : 0) * $limit;
|
||||||
$tags = isset($_GET['tags']) ? Tag::explode($_GET['tags']) : array();
|
$tags = isset($_GET['tags']) ? Tag::explode($_GET['tags']) : array();
|
||||||
|
$count = Image::count_images($tags);
|
||||||
$results = Image::find_images(max($start, 0), min($limit, 100), $tags);
|
$results = Image::find_images(max($start, 0), min($limit, 100), $tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we have the array $results filled with Image objects
|
// Now we have the array $results filled with Image objects
|
||||||
// Let's display them
|
// Let's display them
|
||||||
$xml = "<posts>\n";
|
$xml = "<posts count=\"$count\" offset=\"$start\">\n";
|
||||||
foreach($results as $img)
|
foreach($results as $img)
|
||||||
{
|
{
|
||||||
// Sanity check to see if $img is really an image object
|
// Sanity check to see if $img is really an image object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user