array( 'name' => 'Feed', 'type' => 'list', 'values' => array( 'WIRED Top Stories' => 'rss', // /feed/rss 'Business' => 'business', // /feed/category/business/latest/rss 'Culture' => 'culture', // /feed/category/culture/latest/rss 'Gear' => 'gear', // /feed/category/gear/latest/rss 'Ideas' => 'ideas', // /feed/category/ideas/latest/rss 'Science' => 'science', // /feed/category/science/latest/rss 'Security' => 'security', // /feed/category/security/latest/rss 'Transportation' => 'transportation', // /feed/category/transportation/latest/rss 'Backchannel' => 'backchannel', // /feed/category/backchannel/latest/rss 'WIRED Guides' => 'wired-guide', // /feed/tag/wired-guide/latest/rss 'Photo' => 'photo' // /feed/category/photo/latest/rss ) ) )); public function collectData(){ $feed = $this->getInput('feed'); if(empty($feed) || !ctype_alpha(str_replace('-', '', $feed))) { returnClientError('Invalid feed, please check the "feed" parameter.'); } $feed_url = $this->getURI() . 'feed/'; if ($feed != 'rss') { if ($feed != 'wired-guide') { $feed_url .= 'category/'; } else { $feed_url .= 'tag/'; } $feed_url .= "$feed/latest/"; } $feed_url .= 'rss'; $this->collectExpandableDatas($feed_url); } protected function parseItem($newsItem){ $item = parent::parseItem($newsItem); $article = getSimpleHTMLDOMCached($item['uri']) or returnServerError('Could not request WIRED: ' . $item['uri']); $item['content'] = $this->extractArticleContent($article); $headline = strval($newsItem->description); if(!empty($headline)) { $item['content'] = '
' . $headline . '
' . $item['content']; } $item_image = $article->find('meta[property="og:image"]', 0); if(!empty($item_image)) { $item['enclosures'] = array($item_image->content); $item['content'] = '' . $item['content']; } return $item; } private function extractArticleContent($article){ $content = $article->find('article', 0); $truncate = true; if (empty($content)) { $content = $article->find('div.listicle-main-component__container', 0); $truncate = false; } if (!empty($content)) { $content = $content->innertext; } foreach (array( '