mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-18 17:10:29 +03:00
[HytaleBridge] Fix bridge not pulling all blog posts (#4079)
This commit is contained in:
parent
957a820931
commit
97f5dafbc5
1 changed files with 8 additions and 7 deletions
|
@ -18,26 +18,27 @@ class HytaleBridge extends BridgeAbstract
|
||||||
$blogPosts = json_decode(getContents(self::_API_URL_PUBLISHED));
|
$blogPosts = json_decode(getContents(self::_API_URL_PUBLISHED));
|
||||||
$length = count($blogPosts);
|
$length = count($blogPosts);
|
||||||
|
|
||||||
for ($i = 1; $i < $length; $i += 3) {
|
for ($i = 0; $i < $length; $i += 3) {
|
||||||
$slug = $blogPosts[$i]->slug;
|
$slug = $blogPosts[$i]->slug;
|
||||||
|
|
||||||
$blogPost = json_decode(getContents(self::_API_URL_BLOG_POST . $slug));
|
$blogPost = json_decode(getContents(self::_API_URL_BLOG_POST . $slug));
|
||||||
|
|
||||||
if (property_exists($blogPost, 'previous')) {
|
if (property_exists($blogPost, 'next')) {
|
||||||
$this->addBlogPost($blogPost->previous);
|
$this->addBlogPost($blogPost->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addBlogPost($blogPost);
|
$this->addBlogPost($blogPost);
|
||||||
|
|
||||||
if (property_exists($blogPost, 'next')) {
|
if (property_exists($blogPost, 'previous')) {
|
||||||
$this->addBlogPost($blogPost->next);
|
$this->addBlogPost($blogPost->previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($length % 3 == 1) {
|
if (($length >= 3) && ($length % 3 == 0)) {
|
||||||
$slug = $blogPosts[count($blogPosts) - 1]->slug;
|
$slug = $blogPosts[$length - 1]->slug;
|
||||||
|
|
||||||
$blogPost = json_decode(getContents(self::_API_URL_BLOG_POST . $slug));
|
$blogPost = json_decode(getContents(self::_API_URL_BLOG_POST . $slug));
|
||||||
|
|
||||||
$this->addBlogPost($blogPost);
|
$this->addBlogPost($blogPost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue