items; foreach($articles as $article) { $this->items[] = $this->getArticle($article); } } public function getArticle($articleInfo) { $articleJson = getContents($articleInfo->json_url) or die('Unable to get article !'); $article = json_decode($articleJson); $item = array(); $item['title'] = $article->title; $item['uri'] = $article->url; if($article->content_premium !== null) { $item['content'] = $article->content_premium; } else { $item['content'] = $article->content; } $item['timestamp'] = $article->date_publi; $item['author'] = $article->author->show_name; $item['enclosures'] = array(); foreach($article->images as $image) { $item['enclosures'][] = $image->url; } $item['categories'] = array(); foreach($article->categories as $category) { $item['categories'][] = $category->title; } return $item; } }