Skip to content

Commit

Permalink
[HytaleBridge] Fix bridge not pulling all blog posts (RSS-Bridge#4079)
Browse files Browse the repository at this point in the history
  • Loading branch information
llamasblade authored Apr 16, 2024
1 parent 957a820 commit 97f5daf
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions bridges/HytaleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,27 @@ public function collectData()
$blogPosts = json_decode(getContents(self::_API_URL_PUBLISHED));
$length = count($blogPosts);

for ($i = 1; $i < $length; $i += 3) {
for ($i = 0; $i < $length; $i += 3) {
$slug = $blogPosts[$i]->slug;

$blogPost = json_decode(getContents(self::_API_URL_BLOG_POST . $slug));

if (property_exists($blogPost, 'previous')) {
$this->addBlogPost($blogPost->previous);
if (property_exists($blogPost, 'next')) {
$this->addBlogPost($blogPost->next);
}

$this->addBlogPost($blogPost);

if (property_exists($blogPost, 'next')) {
$this->addBlogPost($blogPost->next);
if (property_exists($blogPost, 'previous')) {
$this->addBlogPost($blogPost->previous);
}
}

if ($length % 3 == 1) {
$slug = $blogPosts[count($blogPosts) - 1]->slug;
if (($length >= 3) && ($length % 3 == 0)) {
$slug = $blogPosts[$length - 1]->slug;

$blogPost = json_decode(getContents(self::_API_URL_BLOG_POST . $slug));

$this->addBlogPost($blogPost);
}
}
Expand Down

0 comments on commit 97f5daf

Please sign in to comment.